Jquery + Ajax returned results
Hi All, new to the Forum and also jquery so please be kind!
I have a page with a url. This URL uses jquery ajax function display a php page showing some results from a mysql database.
In these results I generate a "view details" link for each result.
I have assigned a class and ID to the link which is actually the id number being pulled from the database. So the link looks like
-
<a href="#" class="details" id="id number from database">View Details</a>
Problem is, on pressing the View Details, nothing happens.
If data is called in from ajax, can jquery reference the new id's from this data??
Here is my code
-
$(document).ready(function(){
//This loads the results from the database.
$("#ajaxcontent").load("edit_events.php");
//links in the results have class "details" and id is set to db id.
$(".details").click(function() {
did = this.id;
$.get("ajax_details.php", {id:""+did+""}, function(data) {
$("ajaxcontent").html(data);
});
});
});
Can anybody spot whats wrong or explain if I've misunderstood how it should work.
Thanks
Vince