0

不知道如何消费XMLJSON回应。下面的工作代码。当dataTypeis时text,我得到一个没有或标签的String响应。但我想消费一个和相同的响应。我应该修复什么才能使其正常工作?XMLJSONXMLXMLJSON

Code

$.ajax({
    type: "GET",
    async: false,
    //crossDomain: true, //works without crossDomain
    dataType: "text",
    //dataType: "application/json",
    //dataType: "application/xml",
    url: 'http://localhost:8080/appName/callMe.xml',
    success : function(result) {
        //console.error(JSON.stringify(result));
        console.log(result);
        var ic = document.getElementById('xmlPp');
        ic.innerHTML = result;
    },
    error : function() {
        console.error("error");
        alert('Not working!');                  
    }
});
4

1 回答 1

0

我了解您得到了成功的回复。

在我处理的一个项目中,响应保存在结果成功函数参数的“d”属性中,很像下面的 JSON 示例:

success : function(msg) {
        var myStuff = jQuery.parseJSON(msg.d);
    }
于 2013-09-20T11:25:51.710 回答