JQuery AJAX and ASP.NET web service work locally but not remotely

Interesting here. I have an ASP.NET 1.1 project that contains a web service. I am using jQuery AJAX to call some services from a client. This is what my code looks like:

$.ajax({
    type: "POST",
    url: 'foo.asmx/functionName',
    data: 'foo1=' + foo1 + '&foo2=' + foo2,
    dataType: "xml",
    success: function(xml) {
        //do something with my xml data
    },
    error: function(request, error){
        //handle my error

    }       

});

This works fine when I launch a site from my IDE on localhost. However, when I deploy this site to any other server, I get a parsererror error from jQuery. It does not seem to even call my service since I went into some code to write the log file to disk, and it does not do it there.

The exact same XML should be returned both from my local host and from the server on which I was deployed.

Any ideas?

+5
source share
4 answers

. Firebug , HTML. : " ".

, web.config :

<system.web>                
<webServices>
    <protocols>
        <add name="HttpGet"/>
        <add name="HttpPost"/>
    </protocols>
</webServices>
</system.web>

, localhost web.config . - , , , .

.

+8

"parsererror" jQuery?

:

1- firebug,  http://encosia.com/2009/03/04/use-jquery-to-catch-and-display-aspnet-ajax-service-errors/

2- json '{ "foo1": "bar1", "foo2": "bar2" }'

+1

Are you sure that foo.asmx will take you to the right place, have you changed the folder structure at all?

0
source

Did you examine the XML returned when you deploy the application to ensure that it is the same?

For those who are wondering when you get a jQuery parsing error, it looks like this is due to XML returning web services: http://groups.google.com/group/jquery-en/browse_thread/thread/a97f10ae30824fba?pli = 1

0
source

All Articles