jQuery Ajax方法未定义

So my problem is that data returned in success method is undefined...

Here is my jquery code:

  $('document').ready(function(){



      $('#save').click(function() {

      var dataString = $("#stepform").serialize();

      $.ajax({
     url: "<?php echo base_url();?>create/save/<?php echo $row->id; ?>",
     type: 'POST',
     data: dataString,
     success:function(response){

        alert(response.status);

     }
    });//end ajax

    return false;
});//end click

  }); // end document ready

And php code:

$serverResponse["status"] = 'it worked';
echo json_encode($serverResponse);

And all i'm getting from response.status is 'undefined'... I just can't make it work! Any ideas what i'm doing wrong?

-------------EDIT-------------

Finally i have managed to find a solution to invalid json response. If you are using codeigniter you must write exit() after json_encode. Something like this:

exit(json_encode($yourarray));

If you just echo it then it gives a parse error.

jQuery may not be properly guessing that you are returning JSON. Set the dataType: "json" property on the $.ajax argument object, or add

header("Content-type: application/json");

to your PHP script before emission, or both.