How do I debug jquery AJAX calls?

后端 未结 10 1355
悲&欢浪女
悲&欢浪女 2020-11-29 05:19

I have been working on trying to get AJAX to work with Jquery. My big issue so far has been that I don\'t really know how to figure out where I\'m making a mistake. I don\'t

10条回答
  •  旧巷少年郎
    2020-11-29 05:35

    Make your JQuery call more robust by adding success and error callbacks like this:

     $('#ChangePermission').click(function() {
         $.ajax({
             url: 'change_permission.php',
             type: 'POST',
             data: {
                 'user': document.GetElementById("user").value,
                 'perm': document.GetElementById("perm").value
             },
             success: function(result) { //we got the response
                 alert('Successfully called');
             },
             error: function(jqxhr, status, exception) {
                 alert('Exception:', exception);
             }
         })
     })
    

提交回复
热议问题