ajax:
<script>
$('.click').click(function(evt) {
evt.preventDefault();
var link = $(this).attr('id');
$.ajax({
type: "GET",
url: '\p_details?id'+link,
dataType: "json",
data: {
id: link
}
}).done(function(data) {
$('#property').html(data.html);
alert(data.html);
});
});
</script>
controller: public function index() { //$filter=Input::get('id'); //var_dump($term); $view=DB::table('property_details') ->Where('sale_or_rent', '=', 'rent') ->orWhere('sale_or_rent', '=', 'sale') ->get(); // var_dump($view); 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();
//var_dump($display);
if(count($display)!=0)
{
$returnHTML = view('/pages/fliter')->with('val', $display)->render();
return response()->json(array('success' => true, 'html'=>$returnHTML));
}
else
{
session::flash('status', 'No Records Found!!!');
$returnHTML = view('/pages/fliter')->with('val', $display)->render();
return response()->json(array('success' => true, 'html'=>$returnHTML));
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire