Welcome Guest, Not a member yet? Register   Sign In
jQuery AJAX Success Callback
#1

[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);
   }
  }
});
}


Messages In This Thread
jQuery AJAX Success Callback - by El Forum - 01-19-2012, 12:49 PM
jQuery AJAX Success Callback - by El Forum - 01-19-2012, 01:04 PM
jQuery AJAX Success Callback - by El Forum - 01-19-2012, 01:19 PM
jQuery AJAX Success Callback - by El Forum - 01-19-2012, 01:50 PM



Theme © iAndrew 2016 - Forum software by © MyBB