How to print the array of json responses in laravel view?
03:39 13 Oct 2017

Ajax request:


This is my ajax request for the getting the values from db and need to display it on the view.

Controller:

public function getNonLiveValues()
{
  $verifiedValues= priceInfo::join('productDescription', 'productDescription.productId', '=', 'productPriceDetails.productId')
   ->join('productAdditionalInformation', 'productAdditionalInformation.productId', '=', 'productPriceDetails.productId')
   ->join('products_photos', 'products_photos.productId', '=', 'productAdditionalInformation.productId')->select('products_photos.filename','productPriceDetails.SKUID','productDescription.modelName','productPriceDetails.productName','productPriceDetails.stock','productPriceDetails.sellingPrice','productPriceDetails.nationalDelCharge')
        ->where('productPriceDetails.nonliveStatus', '=', "QCVerified")
      ->Where('productAdditionalInformation.nonliveStatus','=',"QCVerified")
      ->Where('productDescription.nonliveStatus','=',"QCVerified")
      ->Where('products_photos.nonliveStatus','=',"QCVerified")
      ->where('productPriceDetails.listingStatus','=',"Active")->whereNotNull('MRP')->whereNotNull('listingStatus')->whereNotNull('fulfillmentBy')->whereNotNull('ProcurementType')->whereNotNull('procurementSLA')->whereNotNull('stock')->whereNotNull('localDelCharge')->whereNotNull('zonalDelCharge')->whereNotNull('nationalDelCharge')->whereNotNull('packWeight')->whereNotNull('packLength')->whereNotNull('packHeight')->whereNotNull('packBreadth')->whereNotNull('HSN')->whereNotNull('GST')->whereNotNull('luxuryCess')->get();

     $verifiedCount=count($verifiedValues);
     return response()->json(array('verifiedValues'=>$verifiedValues,'verifiedCount'=>$verifiedCount));

  }

This is my laravel controller function where i am returning values from db and its count.

Here is a sample of the returned JSON:

[
  {
    "filename":"MEBFSrGg8rjB1Hao0LOb2php6XaNihWH9zZGYQTy.png",‌
     "SKUID":"SK8900",
     "mo‌​delName":"C123",
     "pro‌​ductName":"Video Door Phone",
     "stock":"6",
     "sellingPrice":"3",
     "nationalDelCharge":"3‌​"
  }
]
php json ajax laravel laravel-5