Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. {"Success":false,"Error":true,"ErrorType":1,"ModelErrors":{"Name":"u0027Nameu0027 must not be empty.","Owner":"u0027Owneru0027 must not be empty.","Email":"u0027Emailu0027 must not be empty.","Password":"u0027Passwordu0027 must not be empty.","Size":"Please provide a valid Number"}}
  2.  
  3. $("form").on('submit', function () {
  4. var form = $('.form');
  5.  
  6.  
  7. var url = form.attr('action');
  8. var formData = form.serialize();
  9. $.ajax({
  10. type: 'POST',
  11. url: url,
  12. dataType: 'json',
  13. data: formData,
  14. success: function (response) {
  15.  
  16.  
  17. if (response.Success==true) {
  18. console.log(response.Success);
  19.  
  20. showMsg(response.Message);
  21. //alert(response.Message);
  22. }
  23.  
  24. //alert(data);
  25. },
  26. error: function (response) {
  27.  
  28. console.log(response.responseText);
  29.  
  30. if (response.responseText.Error === true)
  31.  
  32. {
  33.  
  34. var modelErrors = response.responseText.ModelErrors;
  35.  
  36. console.log(modelErrors);
  37. console.log("Check "+modelErrors);
  38.  
  39. }
  40.  
  41. },
  42.  
  43. cache: false
  44. });
  45. });
  46.  
  47. var response = JSON.stringify(response);
  48. var modelErrors = response.responseText.ModelErrors;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement