0

您好,我正在努力完成这项工作。

var url = 'http://xxxx/getCustomerCardInfo?requestor_email=honey@gmail.com&callback=?';

    $.getJSON(url, function(data){
        alert(data);
    });

ajax 调用成功。但是这个 url 给出了 JSON 作为响应,即

{"targetRequestUri":"/getCustomerCardInfo","javax.servlet.request.key_size":256,"outputMap":{"emailId":"honey@gmail.com","orderList":[{"orderId":"ST210340","orderDate":"2013-04-24 07:12:54.187","orderStatus":"ORDER_COMPLETED","totalMoney":1}],"partyId":"10810","customerName":"honey goyal","telephoneNumber ":"9023605155"},"_FORWARDED_FROM_SERVLET_":true,"javax.servlet.request.cipher_suite":"DHE-RSA-CAMELLIA256-SHA","thisRequestUri":"json"}

但是我的 Firefox 错误控制台在 JSON 中给出了错误:-

SyntaxError: invalid label

在 JSON 开头的第二个字符上,我的意思是在 " in

{"targetRequestUr

而且我没有得到任何警报。知道我做错了什么。我认为这只需要 JSONP 响应并且上面的 JSON 中缺少填充。

4

1 回答 1

0

Got the solution. I need to append padding before the JSON from web Server. But this is not perfect solution according to me because it force me to change third party code. Still waiting for the perfect one so it can work by only changes to client side scripting. like

functionName({"firstName": "John","lastName": "Smith","age": 25});
于 2013-05-28T06:36:54.640 回答