Tuesday, February 14, 2012

codeigniter non latin characters ajax call

I have a textarea and a button where i send the text via ajax to the database to post it.

However when i post non-latin characters... it wont get them and it returns blank... if the text is in latin characters it works fine...

my js code

type: "POST",
url: www+"controller/postText",
dataType: 'json',
data: {
input : input.val(),
success: function(data) {
return data;

my php code

public function postText(){

$input = isset($_POST["input"]) ? trim($_POST["input"]) : "";

echo $input;
return false;

1 comment:

  1. Try accessing your input using $this->input->post('input')

    Also, trim might cause trouble with some UTF8 characters. Check that as well.