How to code access that .inc file using jquery .get request

How can I fix the script below so that it will work EVERY TIME! Sometimes it works and sometimes it doesn’t. Pro JQuery explains what causes this, but it doesn’t talk about how to fix it. I am almost positive it has to do with the ajax ready state but I have no clue how to write it. The web shows about 99 different ways to write ajax and JQuery, its a bit overwhelming.

$.get(Drupal.settings.basePath+’select_sub_cat?cat_id=’+cat_id+’&main_cat_id=1′, function(data) {
$(‘select#edit-caliber-select’).html(data);

});

Was this article helpful?