The solution to the problem of chaotic code in AJAX

time:14-04-12 forum:PHP tools and code
  When using AJAX to return a page to GET, most of the Chinese in the RESPONSETEXT will be in chaos, because xmlhttp is encoded in the UTF-8 code in the decoding test when the responseText is processed, and the Chinese character will be displayed correctly when the server is actually sending out the data stream of UTF-8 and sends out the GBK. When the stream is coded, it's a mess. The solution is to add a HEADER to the stream sent to indicate what code stream is sent, so that XMLHTTP will not be fooled. Phperz.com

PHP
[code]header ('Content-Type:text/html; charset=GB2312'); [/code]

ASP
[code]Response.Charset (.Quot; GB2312.quot;);

prev:PHP AJAX implements no refresh page in G... next:AJAX uses cookie to transmit values
post comment
Notice



approved   Mom and Dad took the baby on the pic...   People in Shandong have gone through...   The teacher was red for the student'...   Sichuan leg free man wrote thousands...   The domain name stolen and retrieved...
rand   Lightweight CMS   PHP Live Chat Pro online customer se...   Free high load, commercial and copyr...   One to one substitution of the PHP a...   PHP gets and clears all the matching...
ads

other

Because all the contents of this site are reproduced from other media, the intention is to provide free services to the public, but it does not mean that this site agrees with its views, and can not be responsible for the authenticity of its verification, such as the copyright unit or individual of the manuscript does not want to publish on this site, please Contact me, I will immediately remove it, thank you. Contact: atseashawk@163.com