How to process xml returned from jsonp using jquery?

纵饮孤独 提交于 2019-12-05 14:26:52

It appears as if you're expecting XML to be returned but you're calling the function which expects JSON. XML and JSON are two different ways of encoding data.

If you want to get the XML as a string then you can use jQuery's get function. This would require that you parse the string yourself in order to extract ...somedata....

But if you would like to process the content of the XML response with jQuery then your best bet is to use the ajax function:

$.ajax({
    url: myurl,
    dataType: 'xml',
    success: function(data) {
        debugger;
        alert(data);
        // untested:
        var theValue = $('string', data).text();
    }
});
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!