I hava a simple jQuery script. I use .ajax() to get some info from my database, it works perfect.
The problem is the php-code genereate xhtml code with a-tags with different class, like .info, .delete and .edit.
I want to do stuff when i click in my .info link. I have tried this code:
$('a.info').click(function (e) {
e.preventDefault();
alert('Do stuff');
});
it dosen't work at all, nothin happens. firebug gives me no error so i dont know how to solve the problem.
$('a').click(function (e) {
e.preventDefault();
alert('Do Stuff 2');
});
works on all links on the site but not on the link that is generated from the php code.
my code:
$(function(){
$.ajax({
type: "POST",
url: 'users.php',
data: 'getall=true',
success: function( r ) {
$(' #content ').html( r );
},
error: function( ) {
alert('Error');
}
});
$('a.info').click(function (e) {
e.preventDefault();
alert('Do Stuff');
});
$('a').click(function (e) {
e.preventDefault();
alert('Do Stuff 2');
});
});