- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am trying to call the post method of a Nodejs webservice which expects a json object in the body.
How would I do this with XDK & IODOCS?
Thanks
Varun
- Tags:
- HTML5
- Intel® XDK
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Varun,
You may use jquery ajax, something like this:
$.ajax({
type:'POST',
url: 'http://localhost:3000/endpoint',
data: '{"email":"'+mail+'", "password":"'+pass+'"}',
dataType: "json",
success: function (response) {
//use response on success
console.log('success');
},
error: function (response) {
console.log('error');
}
});
Regards
Diego
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Diego,
Thanks for the reply
I modified the iodocs js file that exports the webservice to this
return $.ajax({
url: url,
type: 'POST',
data:data,
dataType: "json"
});
The service isnt getting the json data
Thanks
Varun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Diego,
Thanks. I got it working after making a few modification to the code that you suggested
Thanks
Varun
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page