javascript - Request JSONP with text/plain MIME Type -


I am trying to use JSONP to request a feed on any other domain. I know that the type of content should be JSON or Javascript, but this is text / plain and I do not have control over the server, so I can not change the header.

  function asdf () {$ .ajax ({url: "http: //example.com/path/to/sharepoint/_vti_bin/listdata.svc/TestCalendar/$count", jsonp : "Callback", data type: "jsonp", contentType: work with "text / plain", // response: function (feedback) {console.log (response); // server response}}); }  

If I try to make a regular request, then obviously I just get a corrosion error.

XMLHttpRequest $ count can not load There is no 'access-control-permission-origin' header on the requested resource, hence the origin is not allowed. The response status code was 401.

Try to execute your URL directly in the browser to ensure that everything is working properly After that, try with this JQuery configuration:

  $ Ajax ({url: "YOUR_URL", data type: 'jsonp', crossDomain: true, type: 'post', timeout: 30000, // millisecond in sec: false success: function (response) {console.log );}});  

Comments