Nimit Joshi

Nimit Joshi

  • NA
  • 26.9k
  • 14.3m

jQuery- Success function is not working

Jun 11 2014 4:40 AM
I have developed an application in which i am inserting the data by using the service. The data is inserted successfully but the problem is it is not showing the alert which is inside the success function.
My jquery code:
$(document).ready(function () {
 $('#BtnRegister').click(function () {
 $.ajax({
 type: "POST",
 url: "DataService.svc/InsertData",
 data: '{ "Name": "' + $("#TxtUserName").val() + '",
 "Email" : "'
 + $("#TxtUserEmail").val() + '",
 "Category" : "'
 + $("#TxtUserCategory").val() + '",
 "Mobile" : "'
 + $("#TxtUserMobile").val() + '",
 "Message" : "'
 + $("#message").val() + '" }',
 contentType: "application/json; charset=utf-8",
 success: function (data) {
 alert("data");
 },
 error: function () { alert('Loading Failed...'); }
 });
 });
 });
 The error function is running every time



Answers (7)