Javascript 查看页面上没有Ajax响应

Javascript 查看页面上没有Ajax响应,javascript,ajax,laravel,laravel-5,onclick,Javascript,Ajax,Laravel,Laravel 5,Onclick,我的ajax工作正常,我正在尝试在我的查看页面上返回ajax响应,但它没有返回任何内容,但在警报中,我可以看到由ajax生成的响应,因此请建议我如何将ajax响应返回到我的页面 阿贾克斯: 控制器: html: 近期财产 @foreach($val作为$value) {{$value->property\u price} @endforeach 我编写了如下2个foreach循环的sql查询,运行良好。 我没有在这个函数中使用任何ajax调用 Html

我的ajax工作正常,我正在尝试在我的查看页面上返回ajax响应,但它没有返回任何内容,但在警报中,我可以看到由ajax生成的响应,因此请建议我如何将ajax响应返回到我的页面

阿贾克斯:

控制器:

html:


近期财产
@foreach($val作为$value) {{$value->property\u price} @endforeach
我编写了如下2个foreach循环的sql查询,运行良好。 我没有在这个函数中使用任何ajax调用

Html   
            <div class="block-content-inner">
                    <h2 class="center">Recent Properties</h2>
                    <ul class="properties-filter">
                        <li class="selected"><a href="#" id="All" data-filter="*" class="click"><span>All</span></a></li>
                        <li><a href="#" id="featured" data-filter=".property-featured" class="click"><span>Featured</span></a></li>
                        <li><a href="#" id="rent" data-filter=".property-rent" class="click"><span>Rent</span></a></li>
                        <li><a href="#" id="sale" data-filter=".property-sale" class="click "><span>Sale</span></a></li>
                    </ul>
                    <div class="properties-items isotope"  style="position: relative; overflow: hidden; height: 810px;">
                        <div class="row ">
                            @foreach($rent as $value)
                                <div class="property-item property-rent  col-sm-6 col-md-3 isotope-item" style="position: absolute; left: 0px; top: 0px; transform: translate3d(0px, 0px, 0px);">
                                    <div class="property-box">
                                        <div class="property-box-inner">
                                            <h3 class="property-box-title"><a href="#">{{$value->city}}</a></h3>
                                            <h4 class="property-box-subtitle"><a href="#">{{$value->state}}</a></h4>
                                            <div class="property-box-picture">
                                                <div class="property-box-price">{{$value->property_price}}</div>
                                                <div class="">
                                                    <a href="#" class="property-box-picture-target">
                                                        <img src="uploads/{{$value->image}}" alt="" style="width: 275px;height: 200px;">
                                                    </a>
                                                </div>
                                             </div>
                                        </div>
                                    </div>
                                </div>
                               @endforeach
                               @foreach($sale as $val)
                                <div class="property-item property-sale  col-sm-6 col-md-3 isotope-item" style="position: absolute; left: 0px; top: 0px; transform: translate3d(0px, 0px, 0px);">
                                    <div class="property-box">
                                        <div class="property-box-inner">
                                            <h3 class="property-box-title"><a href="#">{{$val->city}}</a></h3>
                                            <h4 class="property-box-subtitle"><a href="#">{{$val->state}}</a></h4>
                                            <div class="property-box-picture">
                                                <div class="property-box-price">{{$val->property_price}}</div>
                                                <div class="">
                                                    <a href="#" class="property-box-picture-target">
                                                        <img src="uploads/{{$val->image}}" alt="" style="width: 275px;height: 200px;">
                                                    </a>
                                                </div>
                                             </div>
                                        </div>
                                    </div>
                                </div>
                               @endforeach




                        </div>
                    </div>
                </div>

对不起,我不明白你的问题。在控制器中,您似乎返回了一些HTML,而在JavaScript代码中,您正在
alert()
-ing这一点。那么,究竟什么是出乎意料的呢?你可以回答你的问题。请尽可能清楚地写一个问题描述。仅仅把它放在标题中的一行是不够的。谢谢你的回答,我已经编辑了我的问题,请提出一些建议,“返回ajax响应”是什么意思?
警报(data.html)
正在工作,那么您的意思是
$('#property').html(data.html)
不工作吗?您通常不会“返回”ajax响应。您发出ajax请求,当它完成时,您可以通过回调执行一些操作(这就是您在这里使用
.done(function(data){…}
)所做的操作)。因此,我如何才能将响应返回到我的viewpage,我有一个具有id属性的div,因此我尝试在该div$('#property').html(data.html)中返回我的响应;是的,所以
$('#property')).html(data.html)
不起任何作用?在页面中看不到任何更改?该代码看起来正确,但我不能确定,因为我没有看到html页面或
data.html的内容
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));
    } 
} 
<div class="container">
    <div class="block-content block-content-small-padding">
        <div class="block-content-inner">
            <h2 class="center">Recent Properties</h2>
            <ul class="properties-filter">
                <li class="selected"><a href="#" data-filter="*" ><span>All</span></a></li>
                <li><a href="{{URL::to('\p_details?id=featured')}}" id="featured" data-filter=".property-featured" class="click"><span>Featured</span></a></li>
                <li><a href="{{ URL::to('\p_details?id=rent')}}" id="rent" data-filter=".property-rent" class="click"><span>Rent</span></a></li>
                <li><a href="{{ URL::to('\p_details?id=sale')}}" id="sale" data-filter=".property-sale" class="click"><span>Sale</span></a></li>
            </ul>


            <div class="properties-items isotope" style="position: relative; overflow: hidden; height: 810px;">
                <div class="row property">
                    @foreach($val as $value)
                    <div class="property-item  col-sm-6 col-md-3 isotope-item " style="position: absolute; left: 0px; top: 0px; transform: translate3d(0px, 0px, 0px);">
                        <div class="property-box">
                            <div class="property-box-inner">
                                <h3 class="property-box-title"><a href="#">{{$value->city}}</a></h3>
                                <h4 class="property-box-subtitle"><a href="#">{{$value->state}}</a></h4>
                                <div class="property-box-picture">
                                    <div class="property-box-price">{{$value->property_price}}</div>
                                    <div class="">
                                        <a href="#" class="property-box-picture-target">
                                            <img src="images/test/{{$value->image}}" alt="">
                                        </a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    @endforeach
                </div>
            </div>
        </div>
    </div>
</div>
Html   
            <div class="block-content-inner">
                    <h2 class="center">Recent Properties</h2>
                    <ul class="properties-filter">
                        <li class="selected"><a href="#" id="All" data-filter="*" class="click"><span>All</span></a></li>
                        <li><a href="#" id="featured" data-filter=".property-featured" class="click"><span>Featured</span></a></li>
                        <li><a href="#" id="rent" data-filter=".property-rent" class="click"><span>Rent</span></a></li>
                        <li><a href="#" id="sale" data-filter=".property-sale" class="click "><span>Sale</span></a></li>
                    </ul>
                    <div class="properties-items isotope"  style="position: relative; overflow: hidden; height: 810px;">
                        <div class="row ">
                            @foreach($rent as $value)
                                <div class="property-item property-rent  col-sm-6 col-md-3 isotope-item" style="position: absolute; left: 0px; top: 0px; transform: translate3d(0px, 0px, 0px);">
                                    <div class="property-box">
                                        <div class="property-box-inner">
                                            <h3 class="property-box-title"><a href="#">{{$value->city}}</a></h3>
                                            <h4 class="property-box-subtitle"><a href="#">{{$value->state}}</a></h4>
                                            <div class="property-box-picture">
                                                <div class="property-box-price">{{$value->property_price}}</div>
                                                <div class="">
                                                    <a href="#" class="property-box-picture-target">
                                                        <img src="uploads/{{$value->image}}" alt="" style="width: 275px;height: 200px;">
                                                    </a>
                                                </div>
                                             </div>
                                        </div>
                                    </div>
                                </div>
                               @endforeach
                               @foreach($sale as $val)
                                <div class="property-item property-sale  col-sm-6 col-md-3 isotope-item" style="position: absolute; left: 0px; top: 0px; transform: translate3d(0px, 0px, 0px);">
                                    <div class="property-box">
                                        <div class="property-box-inner">
                                            <h3 class="property-box-title"><a href="#">{{$val->city}}</a></h3>
                                            <h4 class="property-box-subtitle"><a href="#">{{$val->state}}</a></h4>
                                            <div class="property-box-picture">
                                                <div class="property-box-price">{{$val->property_price}}</div>
                                                <div class="">
                                                    <a href="#" class="property-box-picture-target">
                                                        <img src="uploads/{{$val->image}}" alt="" style="width: 275px;height: 200px;">
                                                    </a>
                                                </div>
                                             </div>
                                        </div>
                                    </div>
                                </div>
                               @endforeach




                        </div>
                    </div>
                </div>
    public function index()
{


    $rent=DB::table('property_details')
    ->Where('sale_or_rent', '=', 'rent')
    ->take(8)
    ->get();

    $sale=DB::table('property_details')
    ->Where('sale_or_rent', '=', 'sale')
    ->take(8)
    ->get();


    $data=array('rent'=>$rent, 'sale'=>$sale);
    return View::make('index')->with($data);
}