//ajax call using post method
<meta name="csrf-token" content="{{ csrf_token() }}"> // in master blade
in blade where ajax call is needed
$.ajax({ url:"/billfinalsave", contentType: 'application/json', data: jsonString,//JSON.stringify( { "first-name": 'affaa', "last-name": 'ertyu' } ), headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')}, method:'post', success:function (resp123) { debugger; console.log("resp:"+resp123['bill_id']); console.log("product_item:"+resp123['product_item'][0].product_id); console.log("Quantity:"+resp123['product_item'][0].quantity); console.log("Quantity:"+resp123['total_price']); } });
in Controller:
Route::post('/billfinalsave' ,'BillController@finalbillsave');
<meta name="csrf-token" content="{{ csrf_token() }}"> // in master blade
in blade where ajax call is needed
$.ajax({ url:"/billfinalsave", contentType: 'application/json', data: jsonString,//JSON.stringify( { "first-name": 'affaa', "last-name": 'ertyu' } ), headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')}, method:'post', success:function (resp123) { debugger; console.log("resp:"+resp123['bill_id']); console.log("product_item:"+resp123['product_item'][0].product_id); console.log("Quantity:"+resp123['product_item'][0].quantity); console.log("Quantity:"+resp123['total_price']); } });
in Controller:
Route::post('/billfinalsave' ,'BillController@finalbillsave');
Comments
Post a Comment