error77
asked on
Submit a form using JQuery Ajax
Hi all,
I have a form and I'm submitting it the traditional way.
I need to do this without the page going away or refreshed. Ajax.
Can anyone give me simple instructions on how to do this please?
I prefer the JQuery way if possible.
Thanks
I have a form and I'm submitting it the traditional way.
I need to do this without the page going away or refreshed. Ajax.
Can anyone give me simple instructions on how to do this please?
I prefer the JQuery way if possible.
Thanks
ASKER
I use PHP.
I've seen that tutorial before but I asked here because I wanted it broken down to the bones.
I've seen that tutorial before but I asked here because I wanted it broken down to the bones.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Actually, your response could contain anything that you want:
$response = json_encode( array(
'success' => true,
'status' => "Let's party"
));
$response = json_encode( array(
'success' => true,
'status' => "Let's party"
));
And then access them through the success function:
$.ajax({
cache: false,
url: 'http://yoursite.com/process.php',
type: "POST",
data: ({
// List your post variables and their values
fullname : fullname,
email : email // etc.
}),
dataType: "json",
success: function(data){
if(data.success)
alert(data.status); // Displays "Let's Party"
// what you want done after successful transmission
}
});
$.ajax({
cache: false,
url: 'http://yoursite.com/process.php',
type: "POST",
data: ({
// List your post variables and their values
fullname : fullname,
email : email // etc.
}),
dataType: "json",
success: function(data){
if(data.success)
alert(data.status); // Displays "Let's Party"
// what you want done after successful transmission
}
});
http://net.tutsplus.com/tutorials/javascript-ajax/submit-a-form-without-page-refresh-using-jquery/
but what is the server side language u use?