Guest User

Guest User

  • Tech Writer
  • 515
  • 45.1k

About Ajax Send Request

Mar 9 2021 12:02 PM
hello,
 
I am getting an Internal server error after button click
 
Following is my button click code :
  1. $('#btnUpdatePermissionContacts').click(function () {  
  2. var abc = '';  
  3. $('input[type=checkbox]').each(function () {  
  4. if (this.checked) {  
  5. abc = abc + $(this).val() + ","  
  6. //assign set value to hidden field  
  7. $('#PermissionIds').val(abc);  
  8. }  
  9. });  
  10. var formdata = new FormData();  
  11. formdata.append("PermissionIds", jQuery("#PermissionIds").val());  
  12. alert($("#PermissionIds").val());  
  13. $("#LoaderOnDEP").show();  
  14. $.ajax({  
  15. url: '/Document/UpdatePermission',  
  16. //url: '@Url.Action("UpdatePermission", "Document")',  
  17. type: "POST",  
  18. contentType: false// Not to set any content header  
  19. processData: false// Not to process data  
  20. data: formdata,  
  21. dataType: 'json',  
  22. success: function (result)  
  23. {  
  24. if (result.val.IsSuccess === true) {  
  25. $DocumentListPartial.html(result.partialView);  
  26. window.IsNew = true;  
  27. $("#toastupdatetdmsg").html('Permission for contact(s) updated successfully.');  
  28. toastbox('toast-updatetd');  
  29. }  
  30. else {  
  31. }  
  32. $("#LoaderOnDEP").hide();  
  33. },  
  34. error: function (err) {  
  35. alert(err.statusText);  
  36. }  
  37. });  
  38. });  

Answers (2)