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.
- <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);
- 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
- $str=$_POST['str'];
-
- foreach($str as $key => $value) {
-
echo "key/value ".$key."/".$value."\n"; // get nothing
$query.= "`".$key."` = '". $value."',";