jQuery ajax request using jsonp error

后端 未结 4 1776
情话喂你
情话喂你 2020-12-17 02:03

I\'m writing an app and I need to access some json data in the client side from another server. Because of the cross domain issue I plan on using jsonp. jQuery allows me to

4条回答
  •  时光说笑
    2020-12-17 02:17

    I encountered this error before, and solved after using jquery-JSONP

    [Example]

    $.getJSON('http://server-url/Handler.ashx/?Callback=DocumentReadStatus',
      {
          userID: vuserID,
          documentID: vdocumentID
      },
      function(result) {
          if (result.readStatus == '1') {
              alert("ACCEPTED");
          }
          else if (result.readStatus == '0') {
              alert("NOT ACCEPTED");
          }
          else {
              alert(result.readStatus);
          }
      });
    

提交回复
热议问题