When I start to learn a new language, I always feel like I'm not doing it the practical, standard way. So here's a question regarding jQuery and if what I'm doing is acceptable.
I have 3 images.
<img src="del.png" class="delete user" />
<img src="del.png" class="delete event" />
<img src="del.png" class="delete recipe" />
Then I have jQuery detect a click event on $('.delete').
$('.delete').click(function() {
if( $(this).hasClass('user') ) {
action = 'user'
}
if( $(this).hasClass('event') ) {
action = 'event'
}
if( $(this).hasClass('recipe') ) {
action = 'recipe'
}
// I then use ajax, send the action as $_POST to the PHP script
// and it tells PHP what to delete.
// Doing it this way, I don't have to use 3 onclick functions and 3 ajax functions.
});