Error when calling webservice from JQuery
I have a weird problem when I try to call a simple webservice method from JQuery.
Locally it works fine, but it doesn't on my test server.
The jquery request looks like this (only showing the actual request, not the whole method):
$.ajax({
type: "POST",
url: "/Service/Service.asmx/AddTab",
data: "tab=" + element.innerHTML,
success: function(msg) {
alert('success');
}
});
When I run it locally from a test server, it works great and I'm wondering if this might be some kind of setting I missed in IIS.
If I go to the .asmx file and click the AddTab method, I get a list of SOAP 1.1 and SOAP 1.2 XML, but not an HTTP POST request. If I go to it locally I get all three (SOAP 1.1, SOAP 1.2, and HTTP Post)
The service is configured as follows:
[WebService(Namespace = "mynamespace")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
[ScriptService()]
public class Service : System.Web.Services.WebService
{
[WebMethod(EnableSession=true)]
[ScriptMethod()]
public void AddTab(string tab)
{
//Some code to add a tab which evidently works locally...
}
}
Does anyone know what I'm missing here?
+2
a source to share
2 answers