0

I have this ajax code:

$("#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;
});

And this is my controller:

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);
}

is working but i can get the view, but i can see the page in the response of firebug here is a image enter image description here

please excuze my english,

6
  • 2
    "is working but i can get the view, but i can see the page" - where's the can't? Also, I don't see you doing anything with the response in the $.ajax call. success: function(_response_){ Commented Aug 27, 2013 at 17:13
  • you did nothing in your ajax success callback? Commented Aug 27, 2013 at 17:20
  • no, because the controller is doing the operations, but is not loanding the view Commented Aug 27, 2013 at 17:30
  • once again excuse my English. Commented Aug 27, 2013 at 17:33
  • 1
    The PHP controller has absolutely nothing to do with your AJAX call. Don't mistake JavaScript's jQuery "$" for PHP's "$". The "page" you can see is the HTML response, from PHP (the server). You are responsible of handling it. I suggested adding the "response" parameter to your success callback. You can then $('body').append(response); for example. Commented Aug 27, 2013 at 17:55

1 Answer 1

1

thanx Sergiu Paraschiv change my success for

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

and this do the trick, thanx for guide me in the right direction

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.