I have a simple webservice in .net
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string EnableRetailer(int ID)
{
var result = Business.Business.EnableRetailer(ID);
return result.ToString();
}
And I'm trying to post to this method using jquery with this code
$.ajax(
{
type: "POST",
url: "/api/BoothWebService.asmx/EnableRetailer",
data: { ID: '2965' },
dataType: "json",
async: true,
success: function (data) {
alert('success');
},
error: function (jqXHR, textStatus, errorThrown) {
alert(errorThrown);
}
});
});
It works on every single browser on my computer, but I get an "internal error" on the iPad.
Any suggestions?
For some reason passing an object as the data only worked when I was on the same machine as it was hosted on. I had to change the ajax call to the following for it to work.
$.ajax(
{
type: "POST",
url: "../api/BoothWebService.asmx/EnableRetailer",
contentType: 'application/json; charset=utf-8',
dataType: 'json',
data: "{ 'ID': " + ID + " }",
async: false,
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.