views:

239

answers:

1

I am having a webmethod that returns some data.I'm using jquery to call that function with its Content type specified as XML.The problem is that it is working on local machine but not on server.The code i'm using is:

var arrInputs = pnl.getElementsByTagName("input");
    str = arrInputs[0].value;
    $.ajax({
        type: "POST",
        url: "../curriculum.asmx/EditListBox",
        dataType: "xml",
        data: "setcur_id=" + str + "",
        processData: false,
        success: function(xml) { ajaxFinish(xml); },
        error: function()
    });

Ajaxfinish is defined afterwards and it works fine on local Is there some more settings i need to do to make it executable

+1  A: 

If you have moved changed the host then the issue is most likely with the page you are requested, not your javascript code.

Check that what is being returned when you request "../curriculum.asmx/EditListBox" is the same in the local and remote environments.

You can do this either by submitting the request manually in your browser (you'll need to use an FF extension to set the post data) or using the Net tab in firebug.

Alternatively I also use an excellent little tool called Charles (http://www.charlesproxy.com/) which monitors all your http requests and allows you to go in and tinker with them.

Either way you will probably find a discrepancy between what is returned on the local and remote versions that is causing the problem.

As mentioned, you might also want to add in a more descriptive error handler that could get you some more details about why it is failing

Addsy