I built a simple asp.net web service. It works when I put the URL of the service: I see the default Microsoft page and the link to the web method. I enter the parameters and get the expected result.
However, when I use $.ajax to call the service, all I get is a 500 error back. For the url parameter, I enter this:
url: "../WebServices/MyService.asmx/MyMethod",
Could that be it?
1) I put a break point and it triggers when I run the service from the browser but it doesn't trigger when called from the jquery function.
2) Is there something I need to tweak in the web.config file? What does the following mean? It's what I see when I access the service from the browser.
3) Also, I'm sending the data in the format of js开发者_开发知识库on when I'm using the jquery way; do I need to change something in the .cs file?
<string xmlns="http://tempuri.org/">
What could be going on?
Thanks for your suggestions.
Ok, if someone's bumping on this issue and finds this page, one of the things to do to make the web service work is to add this:
[System.Web.Script.Services.ScriptService]
add it just before your line
public class ServiceName : System.Web.Services.WebService {
精彩评论