[jQuery] Injecting HTML
[jQuery] Injecting HTML
Hi,
I have some script running on a page, events.php, I use $.ajax to
return the data from that page then on success inject the HTML into a
div in my page.
I have a close button that fades that injected content out.
however the close button refuses to work from my index.php, but when i
have it on my events.php it works.
note : on success i prepend the close button to a div.
what could be the issue ?
$.ajax({
url:"events.php",
cache:false,
success: function(html) {
var selectedEvent = $("#event", html).html();
$("#target").html(selectedEvent);
$("#target").prepend('<div><a href="#" class="close">Close<\/a><\/
div>');
}
});