It works. But is it best practice?
<p>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.</p>

<p>I have 3 images.</p>

<pre><code>&lt;img src="del.png" class="delete user" /&gt;
&lt;img src="del.png" class="delete event" /&gt;
&lt;img src="del.png" class="delete recipe" /&gt;
</code></pre>

<p>Then I have jQuery detect a click event on $('.delete').</p>

<pre><code>$('.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.


});
</code></pre>
