我正在尝试使用jQuery的post()命令将数据发送到Web服务-我想我已经获得了成功的响应,但是我不确定该使用什么来引用返回的数据。这是我的代码:

var insertResponse = $.post(
    "https://xxx.com/spark_submit.aspx",
    {
        NameFirst: "Joe",
        NameLast: "Schmoe",
        PostalCode: "11211",
        EmailAddress: "[email protected]",
        Survey: "76:1139"
    },
    function() {
        console.log(insertResponse);
    }).error(function() {
        console.log("error");
    }
);


insertResponse只是返回一个庞大的对象,其中包括与响应处理有关的所有数据。我只想要返回的XML。我如何找回它?

最佳答案

var insertResponse = $.post(
    "https://xxx.com/spark_submit.aspx",
    {
        NameFirst: "Joe",
        NameLast: "Schmoe",
        PostalCode: "11211",
        EmailAddress: "[email protected]",
        Survey: "76:1139"
    },
    function(data) {//data referes to the returned data from the service
        console.log(data);
        console.log(insertResponse);
    }).error(function() {
        console.log("error");
    }
);

09-18 05:01