嗨,我正在尝试从 jquery Get 请求的 get 函数中获取返回值。
我已经尝试了很多方法,但没有成功。我尝试过的两种形式是:
1)
GetResultOutput = function () {
var outPut = "No Data Found";
var test = test();
return test["outPut"];
}
test = function()
{
outPut = "No Data Found";
**return** $.ajax({
type: "GET",
url: serviceUrl,
dataType: "xml",
success: function (xml) {
outPut = "done";
}
});
}
2)
GetResultOutput = function () {
outPut = "No Data Found";
$.ajax({
type: "GET",
url: serviceUrl,
dataType: "xml",
success: function (xml) {
outPut = "done";
}
});
return outPut;
}
但是他们两个都没有给我任何结果..
第二个输出我没有找到数据。和第一个在谷歌搜索时首选的...结果未定义