如何通过ajax发送php打印表单?

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');

        }
    })
    return false;
}); 

using this, the result I got is the page just going to myfile.php instead of show what I need to show

Response from server is contained in data variable which is argument of success function. I don't know what you exactly want to do with your data but you can try alert(data) to see if the result is good. The thing you are trying with .load() function is not what you need.

The success callback function has data which can be used for your updation operation. see the docs.

success

Type: Function( Anything data, String textStatus, jqXHR jqXHR )

A function to be called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the dataType parameter or the dataFilter callback function, if specified; a string describing the status; and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object. As of jQuery 1.5, the success setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event.

$('#compare').submit(function(e) {
    e.preventDefault();
    $.ajax({
        type: 'POST',
        url: $(this).attr('action'),
        data: $(this).serialize(),
        success: function(data) {
             $('.profile-content').fadeIn('fast');
             //updation-starts
             $('.profile-content').html(data.content);
             //updation-ends
        }
    })
    return false;
});