Ajax尽早加载PHP

i insert a content of textarea in mysql and i fetch that with PHP . with submit form havnt problem and i can insert new data . i have different divs and Textarea that is why i cant use submit input . i use Ajax, but Ajax load process.php earlier than click that is why get value earlier and insert old data . How can i load process.php in ajax on click or anyway to get variable after enter new text in textarea with click. Thank you

<script type="text/javascript">
function useradd()
{
   var data=$("#user,#user2,#user3,#user4").serialize();
   $.ajax({
      type: "POST",
      url: "process.php",
      data: data,
      dataType: "html",
   });
}
</script>

process.php

<?php
    include'db.php';
    $text1=$_POST['text1'];
    $text2=$_POST['text2'];
    $text3=$_POST['text3'];
    $text4=$_POST['text4'];
    $n=new db();
    $n->connect();
    $n->delete();
    $n->insert($text1,$text2,$text3,$text4);
?>

insert

 public function insert($text1,$text2,$text3,$text4)
    {       
         $sql=mysql_query("REPLACE INTO strak(text1,text2,text3,text4) VALUES('$text1','$text2','$text3','$text4' )");
        if(!$sql)
        {
            echo mysql_error();
        }
    }

fetch code in textarea

    <textarea id="t1" name="text1" style="height:100%;">
 <?php
$conn=mysql_connect("localhost","fach","hektar12","p-d");
if($conn)
{ $seldb=mysql_select_db("p-d",$conn);
    if($seldb)
    { $retrive=mysql_query("select text1 from strak",$conn);
        if($retrive)
        { $result=mysql_fetch_row($retrive);

                echo ($result[0]);

        }
        }
    }
    mysql_close($conn);
?>
                               </textarea>

I think it will solve your problem, if your ajax function calls your PHP before getting value for data. And add one button with "onclick" event of your function which contains ajax call.

here you can add, "async: false" into your ajax function

function useradd()
{
    var data=$("#user,#user2,#user3,#user4").serialize();
    $.ajax({
        type: "POST",
        url: "process.php",
        async: false,   // add this line ,it will make process synchronous
        data: data,
        dataType: "html",
    });
}