Hi,
I'm new to ajax and I'm having some issues, I've been hacking away for about 5 hours now and I've hit a deadend so hopefully someone here can help?
What I want to do is perform html form validation (which requires a php script to be called) when a form is submitted, if it evaluates to 'true' print an alert and stop the form from being submitted, if false the form submission can continue.
Here is what I am doing:
<script src="prototype.js"></script>
<script>
function dosubmit() {
$.ajax({ type: 'POST',
url: 'check.php',
success: function(data){
alert("Hello");
}
});
}
</script>
<form method="POST">
<p><input type="text" name="name"></p>
<p><input type="button" value="Submit" onsubmit="dosubmit()"/></p>
</form>
When I submit my form nothing happens, I get no response. Should I at least not get an alert?
Thank you in advance,
David.