I have a form that when you submit it, it sends the data for validation to another php script via ajax. Validation errors are echo\'d back in a div in my form. A success messa
Your AJAX call should have a "success" callback. It looks like you can simply call displayDiv()
in that callback.
Also note that the var divstyle = new String();
line is unnecessary. Strings are immutable in JavaScript, so you are creating an empty string object, which remains unreferenced in the following line. Simply declare the variable when you assign it from document.getElementById()
:
var divstyle = document.getElementById("myForm").style.display;