I'm trying to pass JSON encoded data from Knockout.js to an action in my controller but it's not working and showing as null.
I used the same script in a non-cake php file and it worked perfectly. Is there a special way to decode json data with cake? Say this is the URL being passed.
/orders/submit_order/%7B"orderInfo":["itemNumber":"1","quantity":"1","price":"1.00","productName":"Test Product"]%7D
Here is the action
//OrdersController
function submit_order($order = null){
$order = json_decode($order, true);
print_r($order);
//I also tried commenting out the json decode to simply pass the info without further processing but that just displayed "t"
}
Is there a special way to handle this with Cakephp? With a standard php file I'd set something like
page.php?order=....json data
And then access it with
$order = $_GET['order'];