I have a navegator where I can search other users profile, the result of these searches are showed by an 'echo' with php... and these results have a form wich I need to send with ajax but no matter what I do I just can't stop the submit event...
the result of search it's something like...
$mensaje .= '
<form method="POST" action="users/myfile.php" id="compare">
<input type="text" name="id_user" value="'.$id_user.'"/>
<input type="submit"/>
</form>';
echo $message;
and then I try to use ajax for loading a file without refreshing the page.
$('#compare').submit(function(e) {
e.preventDefault();
$.ajax({
type: 'POST',
url: $(this).attr('action'),
data: $(this).serialize(),
success: function(data) {
$('.profile-content').fadeIn('fast');
$('.profile-content').load('users/myfile.php');
}
})
retu false;
});
using this, the result I got is the page just going to myfile.php instead of show what I need to show
