I tried to submit my form using ajax so i wrote this script :
$(document).ready(
function doAjaxPost() {
var email = $('#user_email').val();
var firstName = $('#user_firstName').val();
var lastName = $('#user_lastName').val();
var password = $('#user_password').val();
$
.ajax({
type : "POST",
async: false ,
url : "home1",
data : "email=" + email + "&firstName=" + firstName
+ "&lastName=" + lastName + "&password=" + password,
success : function(response) {
alert('Error: '+ "test");
if(response.result=="error")
$('#info').html(
response.message);
},
error : function(e) {
alert('Error: ' + e);
}
});
}
);
$('#myForm').submit(doAjaxPost());
then i included it in my page.html.
but when i load the page the script executed but the script must intercept submit event.
how can i prevent the script to execute when i load my page ?
async: false.&?