i have javascript code gets array of ids , sends them using ajax php. reason out of 3 arrays send, first 1 never sent, empty array in php, though have confirmed array not empty before calling $.post()
javascript:
$.post( "ajax.php", { deletedimageguids: deletedimageguids ,imageguids: imageguids ,categoryguids: categoryguids }, function(data, status) { if (status == "success") { alert(data); deletedimageguids = []; imageguids = []; categoryguids = []; } else { alert("there error saving changes"); } } );
ajax.php:
if(!($_server["request_method"] == "post")){ die("request error"); } $deletedimageguids = isset($_post["deleteimageguids"])?$_post["deletedimageguids"] : array(); $imageguids = isset($_post["imageguids"])?$_post["imageguids"] : array(); $categoryguids = isset($_post["categoryguids"])?$_post["categoryguids"] : array();
$deletedimageguids
empty array, while $imageguids
, $categoryguids
work fine.
use following, u have typo.
$deletedimageguids = isset($_post["deletedimageguids"])?$_post["deletedimageguids"] : array();
its not deleteimageguids
its, deletedimageguids
.
Comments
Post a Comment