POSTing data to JSONP
开发者_高级运维Is it possible to POST data to JSONP? Or does all data have to be passed in the querystring as a GET request? any sample code.
thanks
No, you can't post data to JSONP. JSONP has to be "submitted" as a script tag, and script tags cannot POST information.
Hope this helps.
If you're using jQuery, try $.post()
http://api.jquery.com/jQuery.post/
Edit: More detailed solution here: How to use getJSON, sending data with post method?
Here's an example:
$.ajax({
url: ajaxUrl,
dataType: 'jsonp',
type: 'GET',
cache: false,
success: sCallbackFunction,
error: eCallbackFunction,
jsonpCallback: jsonpCallbackFunction,
data: dataObject
});
精彩评论