php - Cant json_encode form data -
php - Cant json_encode form data -
i got ajax request method, send info to.
my ajax phone call follows:
$.ajax({ url: btn.data('url'), type: 'post', data: {_method: 'delete', _token: token, items: json.stringify(_items)}, success: function () { // } })
where token
read meta tag , _items
array id's.
when inspect ajax call, form info contains:
_method:delete _token:15kebpmbt7wvgm8kncwg4idqcw3fpgykzrepn8fu items: ["4","11","15"]
but when dd(json_decode(input::get('items')
returns:
0: 3 1: 0 2: 4 3: 1 4: 1 5: 11 6: 2 7: 2 8: 15 9: 2
edit: when remove json.stringify formdata contains:
items[]:1 items[]:2
and returns array of:
0: 2 1: 0 2: 1 3: 1 4: 1 5: 2 6: 1
here route catch:
route::delete('user/destroy/multiple', function() { dd(input::get('items')); });
i don't know going wrong...
php jquery ajax laravel ajaxform
Comments
Post a Comment