Ok, so I created a test project to make sure jQuery AJAX works with the asp.net service and there are no problems. I used the default HelloWorld service created in VS studio. I call the service through jQuery as follows:
in Default.aspx:
<script language="javascript" type="text/javascript">
$(document).ready(function() {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "TestService.asmx/HelloWorld",
data: "{}",
dataType: "json",
success: function(msg) { alert(msg);},
error: function (XMLHttpRequest, textStatus, errorThrown) {
debugger;
}
});
});
</script>
in TestService.asmx
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
namespace WebServiceTestWitJQuery
{
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
[System.Web.Script.Services.ScriptService]
public class TestService : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
}
}
Then I continued and copied everything in my project and it does not work. I get a 500 server error.
I checked the following:
What else?