0

任何人都可以帮助我如何从下面的 url 显示数据,我试过但我只得到一行数据。我张贴我的代码检查一次

http://www.apexweb.co.in/Apex_Quote/Phone_Gap/Download_Data.asp?un=9393910169


function check() {
var str1 = "http://www.apexweb.co.in/Apex_Quote/Phone_Gap/Download_Data.asp?un=9393910169";
        loadData(str1);
}
        // call service
    function loadData(URL_Str) {
    var head = document.getElementsByTagName('head')[0];
        var script = document.createElement('script');
        script.type = 'text/javascript';
        script.src = URL_Str;
        data = head.appendChild(script);
your_callback(data);
}
    // get response from service
    function your_callback(data) {
                var st1 = data.ContactName;
        var st2 = data.ContactNumber;
        var st3 = data.MainCategory;
        var st4 = data.SubCategory;

        alert(st1);
}
4

1 回答 1

0

希望这可以帮助你

在这里,我检查了您的回复

开始于 your_callback({"ContactName":"AksharmaDelhi","ContactNumber":"9313146690","MainCategory":"NONLOCAL","SubCategory":"LIG"}, 结束于

{"ContactName":"SAIDULU","ContactNumber":"9032364590","MainCategory":"LOCAL","SubCategory":"MIG"});

需要在响应中更改为JSONArray喜欢({ )}[{ }]开始到结束点响应中,您可以获得所有数据

Json 数据解析 看这里

此外,您的 Response is wrong valid Here并且检查是否正确

于 2013-05-17T13:25:41.060 回答