I want to disable the link before ajax call and enable the link right after the response of the ajax. This is what I am trying, but it is not working:
jQuery(this).prop('disabled', false);
This is my link click event in jQuery:
jQuery("#save").click(function (e) {
e.preventDefault();
var pcid = jQuery(this).data('pcid');
var id = jQuery(this).data('id');
jQuery(this).prop('disabled', true);
var state = jQuery('.state').html();
jQuery.post(ajaxurl, data, function (response) {
console.log(response.status);
jQuery(this).prop('disabled', false);
});
});
Everything is working correctly but the link is not been disabled and enabled after link clicked and ajax response.
This is the HTML of the tag:
<a id="save" href="#">SAVE</a>