javascript jquery .change function not executing
<p>hey guys im having a hard time trying to solve this problem </p>

<p>Categories is a select box and it's being populated by database .. what I'm trying to do is, that when I change the category then this function runs and via ajax populates the subcategory </p>

<pre><code>$("#categories").change(function(){

    var selectedCategoryIndex = $('option:selected', '#categories').index();

    $.post(
        'ajax/allAjaxContent.php',
        {
            categoryId: selectedCategoryIndex
        },
        function (response)
        {
            $('#subCategories').html(response);
        }
    );
});
</code></pre>

<p>this function is not being executed at all ... i tried commenting all of the body and just put an alert in it but that doesn't work either, any suggestions on what i should do??</p>

<p>thanks in advance</p>
