Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/365.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript codeigniter ajax返回整个html代码,而不是给定的div部分_Javascript_Codeigniter - Fatal编程技术网

Javascript codeigniter ajax返回整个html代码,而不是给定的div部分

Javascript codeigniter ajax返回整个html代码,而不是给定的div部分,javascript,codeigniter,Javascript,Codeigniter,以下是我的ajax代码: function choosecab(thisvalue){ var carname =$(thisvalue).data('carname'); $.ajax({ type: "POST", url: base_url+"welcome/getcab", data: "carname="+carname, cache: false,

以下是我的ajax代码:

function choosecab(thisvalue){
    var carname =$(thisvalue).data('carname');

    $.ajax({
        type: "POST",
        url: base_url+"welcome/getcab",                         
        data: "carname="+carname, 
        cache: false,
        success: function(html){    
                    console.log(html);          
                $(".right-side-widget").html(html);
                //window.location.href= base_url+"Tariff";  
        }
    });


}   
这是我的控制器:

if($_POST):
        if(isset($_POST) && !empty($_POST)):
            $data = $_POST;             
            $cabfilter=array(
                "carchoosed" =>  $data['carname'],
                "page" => "Tariff/cabfilter",
            );

            $this->session->set_userdata('form2data', $cabfilter);
        $this->load->view('tariff', $cabfilter);    
        endif;
    endif;
cabfilter视图包含以下代码

             <div class="col-lg-6 col-md-6 inp-align" >
                <div class="row sel-car-row" style="padding:0;">
                   <div class="col-lg-12">
                      <select name="car_id" class="selectpicker tariff-select-picker" required="" data-style="btn-info">
                         <option selected="selected" disabled >Select Members </option>     
                         <option  >2 </option>          
                         <option >4 </option>                                                                                    
                         <option  >6 </option>          
                      </select> 
                    </div>
                </div>    
            </div>

挑选成员
2
4
6
来自ajax调用的响应包括页眉和页脚内容。这里我只需要控制器加载的div部分。我猜不出代码出了什么问题?有人能帮我解决这个问题吗?

更改此选项

$this->load->view('tariff', $cabfilter);


显示完整的
tarriff.php
view filetarriff.php只是为了测试。我需要显示包含上述代码的cabfilter.php视图。
echo $this->load->view('cabfilter', $cabfilter, TRUE);