- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I try to create web service method to upload parameter as JSON data through Ajax POST.
It is working fine with a single "string" parameter, but not "Array" type.
Could anyone help?
This is the mywebservicemethod.json file:
{
"endpoints": [
{
"name": "Update interests catergories",
"methods": [
{
"MethodName": "updateInterests",
"Synopsis": "Update interests",
"parameters": [
{
"Name": "newInterestedCategories",
"Required": "Y",
"Default": [],
"Type": "array",
"Description": "categories array"
}
]
}
]
}
]
}
And in mywebservicemethod.js file, I try to read parameter:
var categories = params.newInterestedCategories;
in ajax call, it is converted to JSON:
data: JSON.stringify( {"newInterestedCategories":categories} ),
Under Explore Services, I typed in ["News"] as Value of parameter.
In the end, the ajax call send this as captured by Fiddle:
{"newInterestedCategories":"[\"News\"]"}
What I want is {"newInterestedCategories":["News"]}
By the way, angularjs is referenced in the project.
Thanks very much!
Qiang
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page