Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-02-2011, 06:31 AM   PM User | #1
ankifreeze
New Coder

 
Join Date: Dec 2010
Posts: 62
Thanks: 2
Thanked 0 Times in 0 Posts
ankifreeze is an unknown quantity at this point
how to retrieve chinese,japan, rusia,arabic character using jquery from database?

hello....first I can retrieve chinese,rusia,arabic from database without jquery or ajax.... but when I retrieve chinese,rusia,arabic from database using jquery or ajax it couldn't

Code:
function getdata(str)
{
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","data.php?a="+str,true);
xmlhttp.send();
}
Code:
<script type="text/javascript">
$(document).ready(function() {


	$('#Form').submit(function() {
		$.ajax({
			type: 'GET',
			url: $(this).attr('action'),
			data: $(this).serialize(),
			success: function(data) {
				$('#data').html(data);
			}
		})
		return false;
	})
})


</script>

...... I have used accept-charset="UTF-8" in form and meta content="text/html;charset=utf-8" but still failed....

Last edited by ankifreeze; 03-02-2011 at 02:41 PM..
ankifreeze is offline   Reply With Quote
Old 03-02-2011, 09:09 AM   PM User | #2
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
devnull69 will become famous soon enough
You should tell $.ajax the contentType of the received data
Code:
$.ajax({
   ...,
   contentType: 'application/x-www-form-urlencoded;charset=UTF-8',
   ...
});
And you should output the characters from the script/page of the "action" attribute using something like this (PHP example):
Code:
<?php header('Content-Type: text/html; charset=UTF-8'); ?>
devnull69 is offline   Reply With Quote
Old 03-02-2011, 02:40 PM   PM User | #3
ankifreeze
New Coder

 
Join Date: Dec 2010
Posts: 62
Thanks: 2
Thanked 0 Times in 0 Posts
ankifreeze is an unknown quantity at this point
Quote:
Originally Posted by devnull69 View Post
You should tell $.ajax the contentType of the received data
Code:
$.ajax({
   ...,
   contentType: 'application/x-www-form-urlencoded;charset=UTF-8',
   ...
});
And you should output the characters from the script/page of the "action" attribute using something like this (PHP example):
Code:
<?php header('Content-Type: text/html; charset=UTF-8'); ?>
hello...I have resolved my problem....I put charset="utf-8" in
Code:
<script type="text/javascript" src="jquery-1.3.2.min.js" charset="utf-8"></script>
and I set configuration on mysql default-character-set=utf8
character-set-server = utf8
collation-server = utf8_general_ci

thanks for help me....
ankifreeze is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:43 AM.


Advertisement
Log in to turn off these ads.