extjs AjaxÎÊÌâ - Web ¿ª·¢ / JavaScript
¸ù¾Ý·þÎñÆ÷·µ»ØµÄ½á¹û,ÅжÏÏÔʾÄÄÒ»¸öpanel¾ÓÈ»²»³É¹¦,ûÕÒµ½¿ÉÐеĽâ¾ö·½°¸,´úÂëÈçÏÂ:
var sign=0;
Ext.Ajax.request({
url:'xxx.action', //ÕâÀï·µ»Ø"true"
method:'GET',
success:function(form,action){
sign=1; },
failure:function(form,action){
sign=2;
}
});
Õâ¸öajax·µ»Øtrue
if(sign =1){alert("1");}
else{alert("2");}
ÎÊÌâ:
Ext.Ajax.requestºÃÏñ²»ÄÜ·ÃÎʱäÀï,Èç¹ûÏë×öÕâ¸öÅжÏÓкõķ½·¨Âð,ÒÔÉÏ¿ÉÄÜÊÇ´íÎó·½·¨,googleÁËһЩҲû½â¾ö
ûÓлáµÄ?
×ÔÒѶ¥Ò»ÏÂ!
{{
Ïà¹ØÎÊ´ð£º
ÎÒÏÖÔÚÓÃstruts2¿ò¼Ü,ÐèҪʹÓÃajaxʵÏÖ¾Ö²¿Ë¢Ð£¬µ«ÊÇ´ÓÈÝÆ÷Àï·µ»ØµÄÖµ²»ÖªµÀÔõô´Óstruts.xmlÅäÖÃÎļþÀïÓ³Éäµ½jspÒ³ÃæÀÒÔÇ°servletÀïдout.orint("xxxxx")¾Í¿ÉÒԵõ½~£¬µ«ÊÇÏÖÔÚÓÃstruts¾Í²»ÖªµÀÔõôР......
ÎÒJSPµÄÒ³ÃæÊÇ£º
<%@ page language="java" contentType="text/html; charset=gb2312"
%>
<script>
function Save(){
xmlHttp=GetXmlHttpObject()
if(xmlHttp==nul ......
ÎÒÔÚÒ»¸öhtmlÖÐдÈçÏ´úÂ룺
JScript code:
<html>
<head>
<script type="text/javascript" charset="utf-8"
src="script/jquery-1.3.2.min ......
ÔËÐÐÕý³£µÄÇé¿ö£º£¨·µ»ØÕýÈ·µÄ responseText£©
Îļþ·¾¶ ·þÎñÆ÷
/html/ajax.html 192.168.1.102
/js/ajax.js 192.168.1.102
/ashx/ajax.ashx 192.168.1.102
ÔËÐÐÓÐÎÊÌâµÄÇé¿ö£¨responseText ·µ»ØֵΪ¿Õ£©
......
¿´ÁËһЩÊ飬Ҳд¹ýһЩ¼òµ¥µÄÀý×Ó£¬¸Ð¾õajax¾ÍÊÇÓÃÌض¨µÄ¶ÔÏóÈ¥¡°ÎÊ¡±·þÎñÆ÷ÐÅÏ¢£¬ÔÙÓÃjavascript°ÑÎÊÀ´µÄÐÅÏ¢¡°Ð´¡±ÔÚÍøÒ³ÉÏ
Õâ¾ÍÓÐÒ»¸öÎÊÌâÁË£¬Èç¹û¡°ÎÊ¡±»ØÀ´µÄÐÅÏ¢ÊÇÒ»¸öºÜ¸´ÔӵĶ«Î÷£¬ÄÇjavascriptÀï¾ÍÒªÓÐ·Ç ......