[eluser]jamgood96[/eluser]
I'm working starting back to work a database for my company after almost two months away from it. I made fair progress previously, but am finding a few issues I left unresolved and have no idea how to address right now.
The main one is in my "add client" portion of the code. Right now, I have a css popup box load with a form to input new client information. Once submitted, the data is validated and if all is good, the data is input into the database. If it is not correct, the form shows errors.
The issue I am having is that once the form is submitted and validated, I need to have the pop-up close and the page refresh via AJAX to load the new client's information. This means that a clientID number needs to be passed back if successful, otherwise the HTML data needs to be reloaded into the form to show the errors.
Any ideas how to go about this? This is little tricky for me to relay, so if you need more information I'd be more than happy to give it.
Thanks!
Code:
function validateClientInfo(telephone,telephone2) {
//alert('sending to validate');
$.ajax({
url: "addPopUp/validate",
type: "POST",
dataType: "html",
data: $('#addClientForm').serialize() + "&telephone;=" + telephone + "&telephone2;=" + telephone2,
success: function(html) {
alert(html);
if (html=="success") {
closePopUpBox();
loadClient(html);
} else {
openPopUpBox(html);
}
}
});
}