I am working on a form to submit contact information i have it set to echo what the jquery sees and its showing [object object].
[code]
$(document).ready(function()
{
$(“#contact”).submit(function()
{
//remove all the class add the messagebox classes and start fading
$(“#msgbox”).removeClass().addClass(‘messagebox’).text(‘Submitting’).fadeIn(1000);
//check the username exists or not from ajax
$.post(“template/ajax_contact.php”,{ name:$(‘#name’),email:$(‘#email’),number:$(‘#number’),comments:$(‘#comments’),sample:$(‘#sample’) } ,function(data)
{
if(data==’passed’) //if correct login detail
{
$(“#msgbox”).fadeTo(200,0.1,function() //start fading the messagebox
{
//add message and change the class of the box and start fading
$(this).html(‘Logging In’).addClass(‘messageboxok’).fadeTo(900,1,
function()
{
//redirect to secure page
document.location=’success.php’;
});
});
}
if(data==’spam’) //if correct login detail
{
$(“#msgbox”).fadeTo(200,0.1,function()
{
$(this).html(‘We believe you are not a person’).addClass(‘messageboxerror’).fadeTo(900,1);
});
}
if(data==’error’) //if correct login detail
{
$(“#msgbox”).fadeTo(200,0.1,function()
{
$(this).html(‘We believe you are not a person’).addClass(‘messageboxerror’).fadeTo(900,1);
});
}
else
{
$(“#msgbox”).fadeTo(200,0.1,function() //start fading the messagebox
{
//add message and change the class of the box and start fading
$(this).html(data).addClass(‘messageboxerror’).fadeTo(900,1);
});
}
});
return false; //not to post the form physically
});
//now call the ajax also focus move from
$(“#password”).blur(function()
{
$(“#contact”).trigger(‘submit’);
});
});
Can anyone help straighten this out? Also do you need the form and php code behind this?