0

以下是我的代码:

$.ajax({
              url: url,
              type: 'GET',
              dataType: 'jsonp',
              error: function(xhr, status, error) {
                       alert("xhr="+xhr+"  status="+status+"   Error="+error);
                     },
                     success: function(jsonp) { 
                       alert("success");
                     }
      });

网址包含位于我所做的外部服务器上的 php 文件echo json_encode($array);

响应显示在 firebug net 选项卡中,但警报显示以下错误:

xhr=[object Object] status=parsererror Error=Error: jQuery17209610263814778152_1338375769339 未被调用。alert 未显示成功

4

1 回答 1

4

试试这个:

echo $_GET["callback"] . "(" . json_encode( $array ) . ");";
于 2012-05-30T11:26:32.297 回答