I'm trying to call a webservice using ajax, im getting a internal 500 ERROR.Can you please advise im not sure what im doing wrong, i can call a webmethod with no problem.
JQUERY AJAX CALL
<script type="text/javascript">
function LoginVailid() {
$.ajax({
url: "http://localhost:49301/AppService.asmx/LoggonAuthentication",
contentType: "application/json; charset=utf-8",
data: "{}",
dataType: "jsonp",
jsonp: "callback",
crossDomain: true,
success: function (json) {
alert(json.d);
},
error: function () {
alert("Hit error fn!");
}
});
}
</script>
WEBSERVICE METHOD
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
[System.Web.Script.Services.ScriptService]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public string LoggonAuthentication()
{
return "Hello World";
}
}