Jquery help. I am using .submit and .post stuff.
Hi, I am using the .submit and .post to process a form.
It's a normal form. This form appears after a person clicks a button. So the form isn't showed first but after a person clicks on a button it will fade in the form.
here is the code :
- <script type=\"text/javascript\">
$(document).ready(function(){
$('#interested_data$nu').submit(function() {
$.post('/market/interested.php',$('#interested_data$nu').serialize());
var html='<a>Message:You suceeded on sending the message.</a>';
$('#interested_background$nu').html(html);
setTimeout(close$nu(),3000);
});
});
- </script>
This is the jquery javascript code.
Now this is what is currently happening. When my form named interested_data$nu fades in .
I would type in the input stuff like my name ets. Then I would hit submit button.
It then takes me to the php file. I would notice that the data does get submitted.
The problem here is that it dosen't use ajax. I don't want to redirect a person to another file.
I just want submit the form data and after success on sending it . I was to display a success message for a while and then fade out the form that has the success message.
So far the form acts just like a html form. Where the action file which in this case is a php file would be where the person gets redirected to. Which in this case shows a blank page.
any ideas to fix this?
If you need the code of the form just ask.
Also if your woundering why I have $nu in my form name. This html is inside a echo""; which means I am using php.
The $nu has a number stored. I have this code inside a loop. So in this case there is 5 same forms just that 4 of the forms are located lower down. So it could be like 5 different forms.