Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/240.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
Php Codeigniter使用post和ajax加载视图_Php_Jquery_Ajax_Codeigniter - Fatal编程技术网

Php Codeigniter使用post和ajax加载视图

Php Codeigniter使用post和ajax加载视图,php,jquery,ajax,codeigniter,Php,Jquery,Ajax,Codeigniter,我有以下ajax代码: $("#comparar").click(function() { var oTable = $('#propiedades').dataTable(); var sData = $('input', oTable.fnGetNodes()).serialize(); console.log(sData); $.ajax({ type : "POST", url : "/zcms/comparar/propi

我有以下ajax代码:

$("#comparar").click(function() {
    var oTable = $('#propiedades').dataTable();
    var sData = $('input', oTable.fnGetNodes()).serialize();
    console.log(sData);
    $.ajax({
        type : "POST",
        url : "/zcms/comparar/propiedades",
        data : sData,
        dataType: 'json',
        success: function(){
         $('#profitSignal').modal('hide');
        // window.location="http://btsignals.com/index.php/zcms/performance";
         }
    });
    // cierra ajax contactG

    return true;
});
这是我的控制器:

function propiedades()
{
    $data['title'] = 'Comparar Propiedades';
    $data['properties1'] = $this -> zcms_properties_model -> get_property_comparativa();

    $data['main_content'] = 'zcms/comparativa';
    $propertiesdetalle = $data['properties1'];


    //$this->output->enable_profiler(TRUE);
    $this -> load -> view('zcms/template', $data);
}

正在工作,但我可以获得视图,但我可以看到firebug响应中的页面,这是一张图片


请原谅我的英语,thanx Sergiu Parachiv将我的成功改变为

       success: function(data){
    if(data)
$("body").html(data);
}

这就是诀窍,thanx为我指引了正确的方向

“正在工作,但我能看到视图,但我能看到页面”-不能的页面在哪里?另外,我没有看到您对$.ajax调用中的响应做任何处理<代码>成功:函数(_response){您在ajax成功回调中没有做任何操作?没有,因为控制器正在执行操作,但没有再次拖出视图请原谅我的英语。PHP控制器与您的ajax调用完全无关。不要将JavaScript的jQuery“$”误认为PHP的“$”。页面您可以看到来自PHP(服务器)的HTML响应。您负责处理它。我建议将“response”参数添加到
success
回调中。然后您可以
$('body')。例如,追加(响应);