AJAX JSONP call automatically adding callback parameter. How to remove that?

前端 未结 2 1586
梦如初夏
梦如初夏 2021-02-14 05:23

I have few Services- with clean-URLs

and while calling each service, the URL pattern is being checked.

Now am calling those URLs via AJAX from another server u

相关标签:
2条回答
  • 2021-02-14 05:44

    You should set jsonp: false and not jsonpCallback: false. You should also explicitly set the jsonpCallback option to the callback name you expect to receive from the service.

    Reference: http://api.jquery.com/jQuery.ajax/

    0 讨论(0)
  • 2021-02-14 05:49
    1. If you set cacheing to true ie will cache the request response, and all subsequent JSONP calls will not return new data.

    2. Without the callback JSONP is unusable, because there is no way to read the response. The callback is the whole point of JSONP.

    3. Your server must be set up to handle a JSONP request. The url you send will not effect the client side. So your problem must be on the server-side. Which is where you should handle it. Making this not a jQuery problem.

    If you are using a custom callback Try this, but a custom callback is not the same as removing the callback:

     jsonpCallback : "callbackMethod"
    
    0 讨论(0)
提交回复
热议问题