Qualcuno sa quest'errore come posso risolverlo:
The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must to be declared in the document or in the transfer protocol.
return window.JSON.parse( data );
dove la mia chiamata ajax è
Codice PHP:
function get_messages (){
//alert(base_url+ "index.php/chat/ajax_get_message/"+ chat_id);
$.ajax({
type: "POST" ,
dataType: "json" ,
url: base_url + "index.php/chat/ajax_get_message/" + chat_id ,
success: function(data){
alert("1");
if (data.status == 'ok'){
$('#my_chat_view').html(data.content);
alert("2");
}
alert("3");
}
});
return false;
}
get_messages();
e il mio controller
Codice PHP:
function ajax_get_message($chat_id){
$messages = $this->chat_model->chat_get_messages($chat_id);
$result = array('status'=>'ok','content'=> '');
//header('Content-Type: application/x-json; charset=utf-8');
//return json_encode($result);
if ($messages->num_rows() > 0){
$messages_html = '<ul>';
foreach ($messages-> result() as $mess){
$messages_html .= '[*]'. $mess->message .'';
}
$messages_html .= '[/list]';
$result = array('status'=>'ok','content'=>$messages_html);
//header('Content-Type: application/x-json; charset=utf-8');
return json_encode($result);
}
else{
//header('Content-Type: application/x-json; charset=utf-8');
$result = array('status'=>'ok','content'=> '');
return json_encode($result);
}
Ho provato a mettere i meta tag sopra l'header cosi
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">