Answer the question
In order to leave comments, you need to log in
How to bind a click event to an element using ajax?
function getDataForDiv(){
var url = "/getDataForDiv/";
$.ajax({
async: true,
type: 'POST',
url: url,
dataType: 'json',
success: function(data){
$('#someDiv').click(function(){
alert(data)
});
}
});
}
Answer the question
In order to leave comments, you need to log in
if (e.attributes[i].nodeName !== 'href' && e.attributes[i].nodeName !== 'src') {
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question