当前位置: 动力学知识库 > 问答 > 编程问答 >

php - Posting through jQuery yields undefined characters

问题描述:

When I try to post through jQuery it yields undefined characters. I'm using this jQuery code;

jQuery(document).ready(function($)

{

$("#status_submit").on('click', function()

{

var message = $( "#message" ).val();

var uid = $( "#uid" ).val();

$.ajax(

{

type : "post",

dataType: "html",

url : "pro_profile.php?action=do_post_status",

data : "message="+message+"&uid="+uid,

success : function(response)

{

$('#show_custom_status').hide().html(response).fadeIn("slow");

document.getElementById('message').value = '';

document.getElementById('show_post_status').hide();

//alert("Status has been posted successfully.");

},

error : function(response)

{

alert(response);

}

});

return false;

});

});

It does posts the message correctly but if I use language other then English then it shows the characters like this;

The PHP I used is;

 $insert_array = array(

"uid" => $uid,

"message" => $db->escape_string($mybb->input['message']),

"dateline" => TIME_NOW

);

$db->insert_query("pp_status", $insert_array);

So its fine as far as code is concerned.

Please help!

网友答案:

Change database collation from latin1_swedish_ci to utf8_general_ci

Other code seems correct.

分享给朋友:
您可能感兴趣的文章:
随机阅读: