Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 08, 2012 12:49 PM by shtrudel
Member
461 Points
537 Posts
Apr 08, 2012 08:34 AM|LINK
Hi there,
I created a web method called dummy for testing purposes, I am using the following ajax code to call that web method -
function dummy() { $.ajax({ url: 'services/chatEngine.asmx?op=dummy', async: true, type: "GET", complete: function () { alert('Done'); }, success: function (a, b, c) { alert('Success'); } }); }
The above code is working fine, the problem starts if I am using POST instead of GET, then the success function never runs.
The dummy web method code follows -
<WebMethod(True)> Public Function dummy(ee As String) As String Return "" End Function
Any idea why the ajax call when call type is set to POST never succeed ?
All-Star
30184 Points
4906 Posts
Apr 08, 2012 09:46 AM|LINK
Hi,
Add an error function and check what happens.
Apr 08, 2012 10:04 AM|LINK
I added an error handler to the call which output error 500 Internal server error when run.
When I change the ajax call type to GET no error occurs.
Apr 08, 2012 10:47 AM|LINK
Try this-
http://delicious.com/anupdg/webservice+webmethod
Apr 08, 2012 12:49 PM|LINK
Hi again,
Spending couple of hours I found out that the service class must have <ScriptService()> attribute to enable it to be called from javascript.
shtrudel
Member
461 Points
537 Posts
jquery.ajax GET vs. POST
Apr 08, 2012 08:34 AM|LINK
Hi there,
I created a web method called dummy for testing purposes, I am using the following ajax code to call that web method -
The above code is working fine, the problem starts if I am using POST instead of GET, then the success function never runs.
The dummy web method code follows -
Any idea why the ajax call when call type is set to POST never succeed ?
asteranup
All-Star
30184 Points
4906 Posts
Re: jquery.ajax GET vs. POST
Apr 08, 2012 09:46 AM|LINK
Hi,
Add an error function and check what happens.
Anup Das Gupta
Mark as Answer if you feel so. Visit My Blog
shtrudel
Member
461 Points
537 Posts
Re: jquery.ajax GET vs. POST
Apr 08, 2012 10:04 AM|LINK
Hi there,
I added an error handler to the call which output error 500 Internal server error when run.
When I change the ajax call type to GET no error occurs.
asteranup
All-Star
30184 Points
4906 Posts
Re: jquery.ajax GET vs. POST
Apr 08, 2012 10:47 AM|LINK
Hi,
Try this-
http://delicious.com/anupdg/webservice+webmethod
Anup Das Gupta
Mark as Answer if you feel so. Visit My Blog
shtrudel
Member
461 Points
537 Posts
Re: jquery.ajax GET vs. POST
Apr 08, 2012 12:49 PM|LINK
Hi again,
Spending couple of hours I found out that the service class must have <ScriptService()> attribute to enable it to be called from javascript.