Json stringify / parse
While sending ajax we can convert object into a string with
JSON.stringify()
function...
$.ajax({
            url: '/api/page/delete',
            type: 'DELETE',
            data: JSON.stringify({
                'id': id,                   
                 '_token': ' {{ csrf_token() }} '
             }),
Then parse the result to reach data item:

success: function(result) {
                    parsed_result = JSON.parse(result)
                    items = parsed_result.data.items
}
by Luka Tatarishvili
4 years ago
JavaScript
json
0
Pro tip: use ```triple backticks around text``` to write in code fences