Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ajaxÂÒÂë½â¾ö×ܽá


javascriptÑØÓÃjavaµÄ×Ö·û´¦Àí·½Ê½£¬ÄÚ²¿ÊÇʹÓÃunicodeÀ´´¦ÀíËùÓÐ×Ö·ûµÄ£¬
µÚ¶þ£¬utf-8ÊÇÿ¸öºº×Ö£¨unicode×Ö·û£©ÓÃ3¸ö×Ö½ÚÀ´´æ´¢¡£
µÚÈý£¬ÓÃutf-8À´sendÊý¾ÝÊDz»»á³öÏÖÂÒÂëµÄ£¬ÊǺǫ́³ÌÐòûÓÐÕýÈ·½âÂë²Å»á³öÏÖÂÒÂë¡£
µÚËÄ£¬ajax·¢ËÍÊý¾ÝµÄʱºòÈç¹ûÐÞ¸Ä Content-Type Ϊ application/x-www-form-urlencoded"£¬¿Ï¶¨ÊÇÓÃpost·½Ê½£¬¶ø“Ì«´óµÄÊý¾ÝÍùÍù»á³ö´í”ÊÇÓÃGET·½Ê½·¢ËÍÊý¾ÝÔì³ÉµÄ¡£
µÚÎ壬ÓÃvbscriptдµÄº¯ÊýÊÇÓÃÀ´°ÑÊý¾Ýת³Égbk±àÂ루²Ù×÷ϵͳĬÈϵıàÂ뷽ʽ¡£Èç¹ûÔÚ·±ÌåϵͳÉϾÍÊÇbig5Ö®ÀàµÄ±àÂ룩µÄ£¬¶ø²»ÊÇgb2312£¬Á½ÕߵıàÂë×Ö·ûÊýÁ¿Ïà²î3±¶×óÓÒ¡£
µÚÁù£¬ÓÃcookieÀ´·¢ËÍÊý¾Ý£¬Ò»ÊǺÜÈÝÒ×Òç³ö£¬¶þÊÇÒª²»Í£µÄ²Áƨ¹É£¬·ñÔòcookieÀïÃæµÄÊý¾ÝÔÚÿ¸öhttpÇëÇ󣨰üÀ¨Í¼Æ¬ºÍ½Å±¾ÇëÇó£©Öж¼»á±»·¢ËÍ¡£ÈýÊDz¢·¢¼¸¸öhttpÇëÇóµÄʱºò£¬Ã»Óа취ָ¶¨ÄǸöcookieÊÇÒª·¢Ë͸øÄǸöhttpÇëÇóµÄ¡£
------------------------
ÓÃAJAX
À´GET»ØÒ»¸öÒ³ÃæÊ±£¬RESPONSETEXTÀïÃæµÄÖÐÎĶà°ë»á³öÏÖÂÒÂ룬ÕâÊÇÒòΪxmlhttpÔÚ´¦Àí·µ»ØµÄresponseTextµÄʱºò£¬ÊǰÑ
resposeBody°´UTF-8±àÂë½ø½âÂ뿼Ðγɵģ¬Èç¹û·þÎñÆ÷ËͳöµÄȷʵÊÇUTF-8µÄÊý¾ÝÁ÷µÄʱºòºº×Ö»áÕýÈ·ÏÔʾ£¬¶øËͳöÁËGBK±àÂëÁ÷µÄʱºò¾Í
ÂÒÁË¡£½â¾öµÄ°ì·¨¾ÍÊÇÔÚËͳöµÄÁ÷ÀïÃæ¼ÓÒ»¸öHEADER£¬Ö¸Ã÷ËͳöµÄÊÇʲô±àÂëÁ÷£¬ÕâÑùXMLHTTP¾Í²»»áÂÒ¸ãÁË¡£
PHP:header(''Content-Type:text/html;charset=GB2312'');
//ASP:Response.Charset("GB2312")
ASP:Response.Charset="GB2312"
JSP:response.setHeader("Charset","GB2312");
·½·¨Ò» (ÕâÖÖ·½·¨²»Ôõô¿É¿¿)
Ïò·þÎñÆ÷·¢ËÍÇëÇó£¬ÔÚ·þÎñÆ÷¶Ë¼ÓÈ룺
¡¡¡¡String string = request.getParmater("parmater");
string = new String(string.getBytes("ISO8859-1"),"GBK");
·þÎñÆ÷Ïò¿Í»§¶Ë·¢Ëͱ¨ÎÄ£º
String static CONTENT_TYPE = "text/html;charset=GBK";
¡¡¡¡response.SetContentType(CONTENT_TYPE);
·½·¨¶þ (²»ÍƼöʹÓÃ,URLDecoder.decode()ÓëÐÂä¯ÀÀÆ÷²»¼æÈÝ)
Ajax POST ÖÐÎÄÂÒÂë½â¾ö
¿´ÁËºÃ¶àÆªÎÄÕÂ,×îÖÕ»¹ÊÇ¿´µ½Ò»Æª,½â¾öÁË×Ô¼ºµÄÎÊÌâ.
ajaxpost.js
var myRequest; // Variable to hold request object
function mysubmit()...{
if (window.XMLHttpRequest)
...{
myRequest = new XMLHttpRequest(); // Standards-compliant browsers
} else if


Ïà¹ØÎĵµ£º

ѧϰAjax½Ì³Ì£¬ÏêϸÁ˽âGetÓëPost

ѧϰAjax½Ì³Ì£¬ÏêϸÁ˽âGetÓëPost
Get·½Ê½:
×÷ÓÃ:¿É´«Ëͼòµ¥Êý¾Ý
´óС:url×î´ó³¤¶ÈÊÇ2083 bytes,¿ÉÒÔÓÃÓÚGET´«µÝÊý¾ÝµÄ³¤¶ÈÊÇ2048 bytes
°üº¬Ìå:Êý¾Ý×·¼Óµ½urlÖз¢ËÍ,Ò²¾ÍÊÇhttpµÄheader´«ËÍ
Post·½Ê½:
×÷ÓÃ:¿É´«Ëͼòµ¥¸´ÔÓÊý¾Ý
´óС:web.configÀïÏÞÖÆ
°üº¬Ìå:Êý¾ÝÔÚhttpÇëÇóµÄʵÌåÄÚÈÝÀï´«ËÍ
AjaxÓÃPostģʽ´«ËÍÊ ......

MVC Json Ajax ¶þ¼¶ ¼¶Á¬

<script type="text/javascript">
$(document).ready(function() {
$("#teamName").change(function() {
$.getJSON('/team/SelectProduct', { teamName: $("#teamName").val() }, function(data) {
$("#productID").empty();


......

XMLHttpRequest Ajax ʵÀý¼ò½é

Ò»¡¢XMLHttpRequest ¶ÔÏóµÄ·½·¨ÓëÊôÐÔ
·½    ·¨
Ãè    Êö
abort()
Í£Ö¹µ±Ç°ÇëÇó
getAllResponseHeaders()
°ÑHTTPÇëÇóµÄËùÓÐÏìÓ¦Êײ¿×÷Ϊ¼ü/Öµ¶Ô·µ»Ø
getResponseHeader("header")
·µ»ØÖ¸¶¨Êײ¿µÄ´®Öµ
open("method", "url")
½¨Á¢¶Ô·þÎñÆ÷µÄµ÷Óá£method²ÎÊý¿ÉÒÔÊÇGET¡¢POST»òPUT¡£ ......

php ajax debug method make log in a text file

log into file
//
ob_start();
echo "<pre>";
print_r($data);
echo "</pre>";
$a=ob_get_contents();
//DAL::remove("insert into mytest(vvv) values('$a')");
$filename = "file.txt";
$file = fopen($filename, "w") ......

ajax ÎÒдµÄÒ»¶Î´úÂë

<mce:script type="text/javascript"><!--
var xmlHttp = false;
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
xmlHttp = false;
}
}
if (!xmlHttp & ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ