I am new to AJAX. I want to call the AJAX function when I click the button using the onclick () event. This is an AJAX function called by the onclick () event
function onclickFunction(aId){
$.ajax({
type: "get",
url: "like_audio",
data: {
aId:aId
},
success: function (data){
alert(data);
},
error: function (xhr, ajaxOptions, thrownError){
}
});
return false;
}
This is how I fire the onclick () event
<a href="" onclick=onclickFunction(id)
source
share