jQuery Post failing on production, works on local system
driving me nutso....
I have a .Net 2.0 webservice that takes a string and returns XML. I have an HTML page that uses jQuery a simple $.post command to call the service and process 开发者_开发问答the return. The service is up on the remote site, I can access it via URL and I can test it successfully using SOAP_UI no problem.
On my machine everything works great but on the remote server, the jQuery call fails.
jQuery code is:
$.post("/sample.asmx/sampleFunction", { StringParam: paramValue },
function(data) {
//stuff
},
"xml");
any thoughts?
- What does FireBug report between the production and local?
- Are the request headers the same?
- What is the result between the two?
- Does [server]/sample.asmx hit the correct service in the production environment?
you have the same virtual directory on your PC and the remote server?
Because you're using "/" and would indicate you're using from the root of the site.
How does it fail?
Did you try using $.ajax
and registring the error
callback?
Have you tried entering the full url in the $.post method?
I found this based on your firebug error (Request format is unrecognized for URL unexpectedly ending in):
You may get this error while calling your web service. In my case it was running perfectly under IIS7 and when deployed on IIS6 it started giving this error. After searching a while I found that I have to enable GET and POST protocols in web.config file.
精彩评论