While debugging in the Firefox console window, I am able to see the output. However, it is not displaying on my view page. Below you will find my ajax code and controller function. Even though I am receiving a result, the view remains blank.
Ajax:
<script>
$('.click').click(function(evt) {
evt.preventDefault();
var link = $(this).attr('id');
$.ajax({
type: "GET",
url: 'property_details',
dataType: "json",
data: {
id: link
}
});
}).done(function(data) {
$('#property').empty().html(data.html);
});
</script>
Controller:
public function index()
{
$view = DB::table('property_details')
->where('sale_or_rent', '=', 'rent')
->orWhere('sale_or_rent', '=', 'sale')
->get();
return view::make('index', array('val'=>$view));
}
public function getPropertyDetails()
{
$filter = Input::get('id');
$display = DB::table('property_details')
->where('sale_or_rent', 'LIKE', '%' . $filter . '%')
->get();
if(count($display) != 0)
{
$returnHTML = view('/pages/fliter')->with('val', $display)->render();
return response()->json(['success' => true, 'html'=> $returnHTML]);
}
else
{
session::flash('status', 'No Records Found!!!');
$returnHTML = view('/pages/fliter')->with('val', $display)->render();
return response()->json(['success' => true, 'html'=> $returnHTML]);
}
}