).
serialize();
$.
ajax({
url:
'addPriceDetails/{{$dataId}}',
type:
"post",
data: data,
dataType:
'json',
success:
function(
response) {
alert(response.
SKUID);
}
});
});
In your Controller
publicfunctionaddPriceDetails(Request $priceform,$dataId) {
return response()->json([
'SKUID' => $priceInfo->SKUID,
'listingStatus' => $priceInfo->listingStatus
]);
I am not sure why you want to return some of the fields you just POSTed back. It would make more sense to return the result of the operation, eg a success or error, and then display that on the front end.
Try below code for addPriceDetails()
method. This is not the solution.
.
.
.
$priceInfo->save();
if(!$priceInfo){
App::abort(500, 'Error');
}
else {
return Redirect::back()->with('SKUID',$priceInfo->SKUID)->with('listingStatus',$priceInfo->listingStatus)->with('MRP',$priceInfo->MRP)->with('sellingPrice',$priceInfo->sellingPrice);
}