Friday, 12 April 2013

jquery ajax call to asmx webservice in asp.net

jQuery script



$.ajax({
    type: "POST",
    url: "/WebServices/UserInfo.asmx/CheckAvailability",
    data: "{ 'Title': '" + TitleName + "' }",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function (response) {
        alert(response);
    },
    error: function (data) {
        alert(data);
    }
}); 

Also made change in web config


<webservices>
      <protocols>
        <add name="HttpGet">
        <add name="HttpPost">
     </protocols>
</webservices>
  
















No comments:

Post a Comment