现在做一个功能:有型号输入框,价格框(已控制不能输入)。当用户输入相关型号(STD924),价格框自动显示相关价格,用户继续输入-E1H的时候,后面的价格框就显示STD924和E1H的价格总和。自动更新。
我已经在action获取了所有的型号和价格集合。本人对ajax不懂。请高人指点!最好有相关资料和实列!
希望加我Q:738651656 详解下!!
我已经在action获取了所有的型号和价格集合。本人对ajax不懂。请高人指点!最好有相关资料和实列!
希望加我Q:738651656 详解下!!
<html>
<head>
<script type="text/javascript">
var xmlhttp;
function loadXMLDoc(url)
{
xmlhttp=null;
if (window.XMLHttpRequest)
{// code for Firefox, Opera, IE7, etc.
xmlhttp=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
if (xmlhttp!=null)
{
xmlhttp.onreadystatechange=state_Change;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
else
{
alert("Your browser does not support XMLHTTP.");
}
}function state_Change()
{
if (xmlhttp.readyState==4)
{// 4 = "loaded"
if (xmlhttp.status==200)
{// 200 = "OK"
document.getElementById('T1').innerHTML=xmlhttp.responseText;
}
else
{
alert("Problem retrieving data:" + xmlhttp.statusText);
}
}
}
</script>
</head><body onload="loadXMLDoc('/example/ajax/test_xmlhttp.txt')">
<div id="T1" style="border:1px solid black;height:40;width:300;padding:5"></div><br />
<button onclick="loadXMLDoc('/example/ajax/test_xmlhttp2.txt')">Click</button>
</body>
$.ajax({
type: "POST",
url: "**.action",
data: "参数名=参数",
success: function(msg){
msg存放的是action还回的数据,
添加你要处理的逻辑
}
});
看下这个,有些帮助
能加你QQ,详细指点下ajax麽?!