I'm trying to send JSON
of view
to a route, but I can not. Unfortunately I know little about JSON
, ajax
, GET
and POST
.
In the view, json:
var json = {
"numeroMesa": numeroMesa,
"itens": itens
};
Remembering that the variable numeroMesa
is a global variable in javascript
and itens
is an array with some numbers.
Soon after, I have:
$.get('addPedido/' + json, function(data) {
alert(data);
});
And on the route, I have:
Route::get('/addPedido/{json}', function($json) {
$json = JSON_decode($json);
return $json;
});
When I send, the alert does not show anything. I'm using the framework laravel
.