i'm trying to getting result from controller to blade using ajax but it showing undefined
Controller Code
function fetchDetail(Request $request){
$iname=$request->get('iname');
$data = add_items::select('*')
->where('item_name', 'LIKE', '%'.$iname.'%')
->get();
return response()->json(['success'=>$data]);
}
Blade Code
success:function(data){
console.log(data.item_name);
console.log(data);
var s=JSON.stringify(data);
var s=JSON.parse(s);
$.each(s,function(i,item){
alert(item.item_name);
});
//$('#countryList').html(data);
},
if i'm printing data normally using
console.log(data);
showing properly, but the problem is with json result
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2HsVR3X
via IFTTT
Aucun commentaire:
Enregistrer un commentaire