I have a script for my contact form, which is showing Thnks message and an image after customer pressed "Submit". The thing is that everything is aligned to the right, but I want to center it. Also, it after the customer pressed "Submit" it pushes the next to it div down to the bottom. I will try to post the code and the link to my website. My website
This is the code itself:
//Contact form AJAX form
function _(id) {
return document.getElementById(id);
}
function submitForm() {
_("mybtn").disabled = true;
_("status").innerHTML = 'please wait ...';
var formdata = new FormData();
formdata.append("n", _("n").value);
formdata.append("e", _("e").value);
formdata.append("p", _("p").value);
formdata.append("m", _("m").value);
formdata.append("plans", $('#my_form').find('input[name="plans"]:checked').val());
var ajax = new XMLHttpRequest();
ajax.open("POST", "example_parser.php");
ajax.onreadystatechange = function() {
if (ajax.readyState == 4 && ajax.status == 200) {
if (ajax.responseText == "success") {
_("my_form").innerHTML = '<h2>Thanks ' + _("n").value + '!</h2><p><img src="images/sent.png"></p>';
} else {
_("status").innerHTML = ajax.responseText;
_("mybtn").disabled = false;
}
}
}
ajax.send(formdata);
}
//END
Btw, I use for styling Bootstrap. Sorry if it is not clear.