Proper way to Call AJAX with serialization Variable plus other Variables

Proper way to Call AJAX with serialization Variable plus other Variables

I am trying to pass not only the serialized form data but a couple of other variables.


  1. <script type="text/javascript" >

        function update() {
       
            var str = $('#account').serialize();

           
        var request = $.ajax({
        url: "AccountRevise.php",
        type: "POST",
        data: {"str":str, "recId":recId, "key":key},
        dataType: "json",       
    }); 
    request.done(retData);
  2. etc, etc.

On the PHP end I try to get the individual values and doesn't work.

Need help on passing data properly please. R


  1. $str=$_POST['str'];
  2.         
  3. foreach($str as $key => $value) {

  4.     echo "key/value ".$key."/".$value."\n";   // get nothing

                         
                $query.= "`".$key."` = '". $value."',";