我已经制作了webservice,并且正在使用webmethod.i从其中获取数据。我已经制作了两个函数。我可以使用两个parseJSON函数在单个函数中调用单个webservice吗?
它随机地向我显示数据,我希望数据显示在两个不同的选项卡中。有时仅在单个选项卡中显示,有时在错误的选项卡中显示。
下面是这段代码
function contacts(){
$.ajax({
type: 'POST',
url: webMethod,
processData: true,
data: { 'country': 'india' },
dataType: "jsonp",
jsonpCallback: 'parseJSON',
contentType: "application/json; charset=utf-8",
success: function (data) {
$detail = $("div.presenter-tabs");
$("div#india", $detail).html($('#contactUsTemplate').render(data));
},
error: function (response, status, data) {
var c = status; //For testing purpose
}
});
$.ajax({
type: 'POST',
url: webMethod,
processData: true,
data: { 'country': 'out of india' },
dataType: "jsonp",
jsonpCallback: 'parseJSON',
contentType: "application/json; charset=utf-8",
success: function (data) {
$detail1 = $("div.presenter-tabs");
$("div#outofindia", $detail1).html($('#contactUsTemplate').render(data));
},
error: function (response, status, data) {
var c = status; //For testing purpose
}
});
}
发布于 2012-05-29 19:52:42
这在我看来很可疑:
$detail1 = $("div.presenter-tabs");
$("div#outofindia", $detail1).html($('#contactUsTemplate').render(data));
尝试将其更改为:
$("div#outofindia").html($('#contactUsTemplate').render(data));
在“印度”回调中也是如此:
$("div#india").html($('#contactUsTemplate').render(data));
https://stackoverflow.com/questions/10798527
复制相似问题