从JSON编码获取数据

I am using echo json_encode($data); to send an array back to jquery ajax. I want to get data from json and retrieve it on input text and I got this error like: The URI you submitted has disallowed characters.

I don't know on how to pass data in model. Btw, I'm using codeigniter.

Once I click the edit button, a modal will appear. Please, help me guys!!

Button

<a onclick="edit_content_by_id('.$row->post_id.')" title="Edit"><span class="ti-pencil"></span>

Model

public function GetContentById($id) {
    $query = $this->db->select('*')->from('cms_posts_tbl cpt')->
    join('cms_contents_tbl cct', 'cct.post_id = cpt.post_id')->
    join('cms_category_tbl ccat', 'ccat.post_category_id = cpt.post_category')->
    where('post_id', $id)->get();   

    foreach($query as $row) {
        $data = $row;
    }

    echo json_encode($data);
}

jQuery Ajax

function edit_content_by_id(id) {
    var data = { content_id : id };
    $.ajax({
        type: 'POST', url: 'http://localhost:81/ci_sample/model/GetContentById('+ id +')',
        data: data, dataType: 'json',
        cache: false,
        success:function(data) {
            $('#modal_content').modal('show');
            $('#modal_content').find($('post_title')).val(data.post_title);
        }
    });
}
header('Access-Control-Allow-Origin:*');

Go to config.php and configure this variable.

$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-@\=';