I have an ajax call:
jQuery.ajax({
type:'POST',
url: 'http://www.mytestsite.com/wp-admin/admin-ajax.php',
data:{
'action':'display_image',
'id_page': 9
},
success:function(data){
$('#ajax').html(data);
}
});
It works perfectly my div ID "ajax" display the html code:
<span id="test">HELLO</span>
The problem is in my footer page i have:
$('#test').on('click', function(){
alert('test');
});
When i click on "HELLO" (the html return of my ajax call) an alert box will display but it doesnt work. I dont know why...