Error calling webservice from JQuery

Posted by Robban on Stack Overflow See other posts from Stack Overflow or by Robban
Published on 2010-04-21T07:58:36Z Indexed on 2010/04/21 8:03 UTC
Read the original article Hit count: 328

Filed under:
|
|
|

I have a strange problem when I'm trying to call a simple webservice method from Jquery.

Locally it works fine, but on my test-server it does not.

The jquery request looks like this (only showing the actual request and not the rest of the method):

    $.ajax({
    type: "POST",
    url: "/Service/Service.asmx/AddTab",
    data: "tab=" + element.innerHTML,
    success: function(msg) {
        alert('success');
    }
});

When I run this locally from the test-server it works fine, which has me wondering if it could be some setting that I've missed in the IIS.

If I navigate to the .asmx file and click the AddTab method I get a list of SOAP 1.1 and SOAP 1.2 XML, but not the HTTP POST request. If I navigate to it locally I get all three (SOAP 1.1, SOAP 1.2 and HTTP Post)

The service is set up 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...
    }

   }

Anyone have a clue what I'm missing here?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about c#