In my code I call a function which first of all displays a form and builds the select drop-down lists with the appropriate options. I then call the following function, passing it a case id. The function:
calls another file that uses AJAX to connect to my database and returns a single row of data for the case id specified.
checks if the ajax function has completed successfully
if successful, it populates the form fields with the json data
This form is correctly populated but if I remove the alert code then it does not populate the form. Can anybody help?
function loadCase (caseID) {
$.get("./case_det/exist_case_det/ajax_get_exist_case_det.php?caseID=" + caseID, function(data, status) {
alert (caseID + " now loading");
if (status === "success") {
json_data=JSON.parse(data);
//save object to localStorage
localStorage['my_case'] = JSON.stringify(json_data);
// Populate Case Detail
$('#categorisation').val(json_data[0].cat_id);
$('#priority').val(json_data[0].priority_id);
$('#type').val(json_data[0].type_id);
$('#stage').val(json_data[0].stage_id);
$('#summary').val(json_data[0].summary);
} else {
alert ("System encountered probl;ems laodign case data");
}
});
}