I am trying to send the serialize string of Jquery sortable to a post method via AJAX
the string it is sending is:
category[]=48&category[]=47
normally, via $_POST
, i will just need to:
$i = 0;
$str = "";
foreach ($_POST['category'] as $value) {
// Execute statement:
$str .= "UPDATE [Table] SET [Position] =". $i ."WHERE [categoryId] =". $value;
$i++;
}
echo $str;
but trying it on Slim:
$request = $app->request;
$cats = $request->post('category');
$i = 0;
$str = "";
foreach ($cats as $value) {
$str .= "UPDATE [Table] SET [Position] =". $i ."WHERE [categoryId] =". $value;
$i++;
}
echo $str;
I am getting empty string, any reason why?
– EDIT –
seems like my only option is to parse_str()
the post?