I want to do a serialize the data that I got from 3rd Party API. The following Picture is what I got from the API
As you can see in the photo, I have received 2 sets of the Information which indicated by the number in the []. And when I do the POST request using jQuery, the multiple Parameters Posts to my Java method. What I would like to do is to encapsulate each set ot the Information into a Group and after that serialize them in one parameter and sent it back as one object that hold all the things inside. How can I do it by Javascrip or jQuery???
anyway, this is my code
function getMediaInfo(InkBlob){
console.log(InkBlob);
jQuery.ajax({
type: 'POST',
url: '/webapp/filepicker/importAssets',
dataType: 'json',
data: {"inkBlob": InkBlob}
}); }
All I want to do is to set only one parameter call inkBlob that contains the Information as Show in the photo above.
How about -
For Serializing js object
var str = JSON.stringify(InkBlob);
jQuery.ajax({
type: 'POST',
url: '/webapp/filepicker/importAssets',
dataType: 'json',
data: {"inkBlob": str}
});
Note
JSON.stringify is not available for older browser, use JSON2.js for older browsers.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.