¼òµ¥AJAX ʹÓÃ
var xmlHttp;
function createXMLHttpRequestss() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
}
function startRequest(){
var projectName = document.getElementById("pronameid").value;
var alarmName = document.getElementById("alarmNameId").value;
var url = "getAgentNo.action?randcount="+Math.random()+"&code="+document.getElementById("selectId").value+"&alarmName="+alarmName+"&projectName="+projectName+"&skillName="+document.getElementById("skillGroupId").value;
createXMLHttpRequestss();
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("get",url,false);
xmlHttp.send(null);
}
function handleStateChange(){
if(xmlHttp.readyState == 4 ) {
if(xmlHttp.status == 200) {
if(xmlHttp.responseText == null || xmlHttp.responseText == ""){
return;
}
var obj =eval('('+ xmlHttp.responseText+')');
Ïà¹ØÎĵµ£º
Ò» ÒýÌâ
ÈçºÎÈÃweb³ÌÐòÓÃÆðÀ´Ïñ×ÀÃæÓ¦ÓóÌÐòÒ»Ñù¼òµ¥£»
ÅÖ¿Í»§¶Ë£¿ÊÝ¿Í»§¶Ë£¿ÈçºÎÑ¡Ôñ£¿-----¿´ÐèÇ󣬿´Óû§µÄʹÓã¬Áé»îµ÷½Ú¡£
²»ÒªÉÁ˸£¬¿Õ°×Ò³³öÏÖ£¿
¶þ ³õʶAjax
1. AjaxÊÇÒ»¸ö¿Í»§¶Ë¼¼Êõ£¬²»ÂÛÄãÏÖÔÚʹÓúÎÖÖ·þÎñÆ÷¶Ë¼¼Êõ£¬¶¼ÄÜʹÓÃAjax£¬¶ø²»¹ÜʹÓõÄÊÇJava¡¢.NET¡¢Ruby¡¢PHP»¹ÊÇCGI¡ ......
jQuery ÊÇÒ»¸öJavaScript ¿â£¬ËüÓÐÖúÓÚ¼ò»¯ JavaScript™ ÒÔ¼° Asynchronous JavaScript + XML (Ajax) ±à³Ì¡£ÓëÀàËÆµÄ JavaScript ¿â²»Í¬£¬jQuery ¾ßÓжÀÌصĻù±¾ÔÀí£¬¿ÉÒÔ¼ò½àµØ±íʾ³£¼ûµÄ¸´ÔÓ´úÂ롣ѧϰ jQuery »ù±¾ÔÀí£¬Ì½Ë÷ÆäÌØÐԺ͹¦ÄÜ£¬Ö´ÐÐһЩ³£¼ûµÄ Ajax ÈÎÎñ²¢ÕÆÎÕÈçºÎʹÓòå¼þÀ©Õ¹ jQuery¡£
jQuery ÊÇʲ ......
1£¬Ð½¨Ò»ÃûΪlogin.htmµÄ¾²Ì¬ÍøÒ³Îļþ£¬×÷ΪµÇ¼ҳÃ棬Èçͼ
body±êÇ©´úÂë
<body onkeydown ="enterLogin()"> <!--Ìí¼Ó°´Ï¼üÅÌʼþ-->
<div style="text-align: center" mce_style="text-align: center">
<table border="1" cellpadding="1">
<tr>
<td align="center" s ......
½ñÌìÓÃajaxµÄpost·½Ê½´«ÖµÊ±£¬Óöµ½Ò»¸öÎÊÌ⣬ʼÖÕûÓÐÕÒµ½ÎÊÌâÔÒò¡£ºóÀ´°Ñ´«µÄÖµÖе¥ÒýºÅÈ¥µôºó£¬jsÕý³£ÁË¡£
¾¹ýËÑË÷£¬Ò²Ã»ÓÐÕÒµ½¾ßÌåÔÒò¡£×îºóͨ¹ýÒþ²ØÓòÀ´ÖÐת¸Ã×Ö·û´®¡£×îºó½â¾öÕâ¸öÎÊÌ⣡ÎÞÓïÁË£¡±¸Íü£¡
js²¿·Ý£º
////Òì²½µ÷Ó÷þÎñÆ÷ÐÅÏ¢
function CallServiceInsert()
{
var url="";
var para ......