I place jquery.js on my footer before </body>
<script type="text/javascript" src="/js/jquery.js"></script>
And why this code is not firing? But when I move jquery.js on header before </head> it working fine..
$(document).ready(function () {
$("#sub-category").hide();
$("#main-category").change(function () {
var id = $(this).val();
var dataString = 'id=' + id;
$.ajax({
type: "POST",
url: "/select-category/",
data: dataString,
cache: false,
success: function (html) {
$("#sub-category").show();
$("#sub-category").html(html);
}
});
});
});
Let me know why code above is not firing when I include jquery.js on my footer.
<head>, where it belongs.