PHP+AJAX ÐÂÊÖÌáÎÊ - PHP / Framework
ÎÒÏëѧϰһÏÂAJAX£¬°´×ÅÍøÉϵÄʵÀýÊÔÁËһϣ¬Ìá½»ºóûÓÐÈκη´Ó¦£¬Çë¸ßÊÖÖ¸½ÌÒÔÏ£¬´úÂëÈçÏ£¬
<script language="javascript">
function saveUserInfo()
{
//»ñÈ¡½ÓÊÜ·µ»ØÐÅÏ¢²ã
var msg = document.getElementById("msg");
//»ñÈ¡±íµ¥¶ÔÏóºÍÓû§ÐÅÏ¢Öµ
var f = document.user_info;
var userName = f.user_name.value;
var userAge = f.user_age.value;
var userSex = f.user_sex.value;
//½ÓÊÕ±íµ¥µÄURLµØÖ·
var url = "/login_mng.php";
//ÐèÒªPOSTµÄÖµ£¬°Ñÿ¸ö±äÁ¿¶¼Í¨¹ý&À´Áª½Ó
var postStr = "user_name="+ userName +"&user_age="+ userAge +"&user_sex="+ userSex;
//alert(postStr);
//ʵÀý»¯Ajax
//var ajax = InitAjax();
var ajax = false;
//¿ªÊ¼³õʼ»¯XMLHttpRequest¶ÔÏó
if(window.XMLHttpRequest) { //Mozilla ä¯ÀÀÆ÷
ajax = new XMLHttpRequest();
if (ajax.overrideMimeType) {//ÉèÖÃMiMEÀà±ð
ajax.overrideMimeType("text/xml");
}
}
else if (window.ActiveXObject) { // IEä¯ÀÀÆ÷
try {
ajax = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
Ïà¹ØÎÊ´ð£º
°´Å¥·ÅÔÚUpdatePanel1£¬Ïëͨ¹ýµã»÷µ÷ÓÃDictionaryTvAdd.aspxµ¯³öÒ»¸ö×Ó´°Ìå
ÓÃÏÂÃæµÄÓï¾äÌáʾÎÒȱÉÙ¶ÔÏó
protected void Button1_Click(object sender, EventArgs e)
{
ScriptManager.R ......
ÎÒÓÃjqueryÎÞË¢ÐÂÉÏ´«Í¼Æ¬ºó·µ»Øjson¸ñʽµÄÊý¾Ý±¨´í
£¨Êµ¼ÊÉÏͼƬÊÇÉÏ´«³É¹¦µÄÁË£¬Ö»ÊÇ·µ»Øjson¸ñʽ×ܶÁ²»µ½£¬×ÜÊDZ¨´í£©
ÎÒµ÷ÊÔÉÏ´«µÄashxÒ³ÈçÏÂ
ÎÞ·¨ÏÔʾ XML Ò³¡£
ʹÓà Ñùʽ±íÎÞ·¨²é¿´ XML ÊäÈë¡£Çë¸ü ......
±±¾©2ÄêPHP¾ÑéÇó¼æÖ°
½Ó·Ö
·¹ý½Ó·Ö£¡.¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£
jf~~~~~~~~~~~~~~Ö§³Ö
ßÀ¡£¡£ÎÒÃÇÐèÒª¼æÖ°£¬¿ÉÊÇÔõôÁªÏµÄãѽ£¿
¶¥¡£¡£¡£ »Ø¸´ÄÚÈÝ »Ø¸´ÄÚÈÝÌ«¶ÌÁË£¡
º¼ÖÝÄãÈ¥²»È¥°¡ ¡£¡£¡£¡£¡ ......
1¡¢ÊDz»ÊÇPHPÖÐÖ»ÄÜʹÓÃmysql_query("update user_aa set money=money2-".$bpanmm." where uid=".$userppp);¸üÐÂÊý¾Ý£¿£¿£¿
2¡¢PHP¸üÐÂmysql_fetch_row($res)Óëmysql_fetch_array($res)ÖеÄÊý¾ ......
ÈçÌ⣬Ôõôд¸öheadÍ·²¿ ÈÃÒ³Ã滺´æ1ÐÇÆÚ¡£
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
Äã°ÑÀïÃæµÄʱ¼ä£¬¸Ä³Éµ±Ç°Ê±¼ä¼ÓÉÏÒ»¸öÐÇÆÚ
¼ÇµÃҪת»»³Égmtʱ¼ä
ÎÒÕâÑùдµÄ ²»ÖªµÀÐв»ÐС£
Ò»¸öÐ ......