I am looking to disable the onclick event after a successful ajax request.
<div class="report_button" id="report_button" title="Reportthis" style="width:65px;height:15px;" onclick="reported_text(user_id,lead_id);">Report</div>
This is the div that I would like to disable after it has been clicked.
function reported_text(user_id,lead_id){
new Ajax.Request("/agent/report/lead-refund",
{
method:"POST",
parameters:"user_id=" + user_id + "&lead_id=" + lead_id ,
onSuccess: function(transport){
alert("Thank you for your response");
jQuery('#report_button').attr("disabled", "disabled");
},
onFailure: function(transport){
$('tag_error_status').innerHTML = '';
alert("Unsuccessful request processing. This will be rectified soon.");
}
});
}
Is there any way to achieve this? The div is used by multiple users, and I need it to only be disabled for a specific user.