从JQUERY调用页面方法无法在Safari中工作(Calling page method from JQUERY not working in Safari)

52 IT屋

I am calling a page method from JQUERY which is working fine in Chrome and Firefox however it doesn't work in Safari, can anyone please help?

function setVariables(city, area, date, pooja, isInstant) {
    
    $.ajax({
        type: "POST",
        url: "Default.aspx/setVariables",
        data: "{city: '" + city + "',area:'" + area + "',date: '" + date + "', pooja: '" + pooja + "',isInstant:' " + isInstant + "'}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: OnsetVariablesSuccess,
        failure: function (response) {
           
        }
    });
}

function OnsetVariablesSuccess(response) {

   
    if (response.d == 1) {
      
    }


}
解决方案
.ajax({ type: "POST", url: "Default.aspx/setVariables", data: "{city: '" + city + "',area:'" + area + "',date: '" + date + "', pooja: '" + pooja + "',isInstant:' " + isInstant + "'}", contentType: "application/json; charset=utf-8", dataType: "json", success: OnsetVariablesSuccess, failure: function (response) { } }); } function OnsetVariablesSuccess(response) { if (response.d == 1) { } }

我正在调用JQUERY的页面方法,它在Chrome和Firefox中工作正常但是在Safari中不起作用,有人可以帮忙吗?



< pre lang =Javascript> function setVariables(city,area,date,pooja,isInstant){

$ .ajax({
类型: POST
url: Default.aspx / setVariables
data: < span class =code-string> {city:' + city + ',area: ' + area + ',date:' + date + ',pooja:' + pooja + ',isInstant:' + isInstant + '}
contentType: < span class =code-string> application / json; charset = utf-8,
dataType: json
成功:OnsetVariablesSuccess,
失败:功能(响应){

}
});
}

function OnsetVariablesSuccess(response){


if (response.d == 1 ){

}


}

解决方案
.ajax({
type: POST
url: Default.aspx / setVariables
data: {city:' + city + ',area:' + area + ',date:' + date + < / span> ',pooja:' + pooja + ',isInstant:' + isInstant + '}
contentType: application / json; charset = utf-8
dataType: json
成功:OnsetVariablesSuccess,
失败:功能(响应){

}
});
}

function OnsetVariablesSuccess(response){


if (response.d == 1 ){

}


}

本文地址:IT屋 » 从JQUERY调用页面方法无法在Safari中工作