开发者

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
    });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜