webservice doesn't get called by jQuery

Posted by aspdotnetuser on Stack Overflow See other posts from Stack Overflow or by aspdotnetuser
Published on 2010-05-25T10:38:40Z Indexed on 2010/05/25 10:41 UTC
Read the original article Hit count: 227

Filed under:
|

Hi,

I want to call a webservice using jQuery.ajax() but the webervice doesn't get called. - If I change the url: to reference a .ashz file it gets called but not .asmx?

Here's the code I'm using:

jQuery.ajax({
        type: "POST",
        url: "/services/CheckUsername.asmx/CheckUsername", // this doesn't get called
        //url: "/services/CheckUsername.ashx/ProcessRequest", this gets called
        data: '{ "context": "' + "username" + '"}',
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',

        success: function (msg) {
            alert("Result: " + msg);
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            alert("Error: " + textStatus)
        }

The .ashz file gets called but a parsererror is retuned because it's returning http context - how can I modify this to get a string return type from a webservice?

Thanks,

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about webservice