I am new to the jQuery AJAX ajax() Method. I have successfully created the function AddATeacher()
which gets called because all the alert messages do popup. However the ajax() Method inside the function does not work. I know this because the addATeacherInsert.php does not load.
I got it to work under firefox, but not on chrome. However it only works in firefox when I have the alert message at the end of the code: alert ("Exiting myJQFunctions...");
, otherwise it stops working all together. I would like it to work when I comment out the alert message at the end of the file. How can I solve this?
function AddATeachers()
{
var tFirstName = $('#teachers_first_name').attr('value');
var tLastName = $('#teachers_surname').attr('value');
alert ("Entering myJQFunctions...");
alert ("Teachers first name is: " + tFirstName);
$.ajax({
type: "GET",
url: "../pgs/addATeacherInsert.php",
data: "tFirstName="+ tFirstName +"&tLastName="+ tLastName,
success: function(html){$("#Ajax_response").html(html);}
});
// works well under firefox but shows alert
// doesnt work at all if commented out.
alert ("Exiting myJQFunctions...");
}