Newbie JQuery help please $.ajax

Newbie JQuery help please $.ajax

Hi all,

I'm really new to web programming, hoping someone can advise me please. Im using the following JQuery function(is that the right term?) to retrieve values from vl_search_projects.php and display them in a drop down list <select tags> contained in the projectdiv. The call is made using the following <select name="ClientID" onChange="getProjects(this.value)"> .This works on most occasions, however it also has a high failure rate where the lists do not appear. Is there a reason why it would fail so frequently? I believe the code fails silently if there are no values returned from vl_search_projects.php.Is this the case or do I need to insert some error trapping?

Any help very much appeciated. Thanking all in advance.


function getProjects(projectId){
$.ajax({
type: "POST",
url: "vl_search_projects.php?id="+projectId,
success: function(html){
$("#projectdiv").html(html);
}

});
}