ajax连动下拉菜单
-------------------------jsp中的js代码--------------------
<script type="text/javascript">
function ajaxFunction(sort){
var xmlHttp;
try{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
} catch (e)
{
// Internet Explorer
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}catch (e)
{
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}catch (e)
{
alert("您的浏览器不支持AJAX!");
return false;
}
}
}
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
document.getElementById("div_product").innerHTML=xmlHttp.responseText;
}
}
xmlHttp.open("POST","problemAction.do?action=showVersions",true);
xmlHttp.send(null);
}
</script
相关文档:
一、JSON 是什么?
JSON 的全称是JavaScript Object Notation,是一种轻量级的数据交换格式。
JSON 与XML 具有相同的特性,例如易于人编写和阅读,易于机器生成和解析。但是JSON 比
XML 数据传输的有效性要高出很多。JSON 完全独立与编程语言,使用文本格式保存。
JSON 数据有两种结构:
• Name-Value 对构成的集 ......
在网上下了IngelliJ9.0,安装完成后,迫不及待的打开,却提示“The JVM could not be started. The main method may have thrown an exception.” 又去网上找了找,解决的办法是把bin目录下的idea.exe.vmoptions 文件有写字板打开,把里面的内容该为-Xms32m
-Xmx512m
-XX:MaxPermSize=120m
-ea
......
index.asp文件 保存utf-8
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8" />
<form id="form1" name="form1" method="post">
<input name="ip" type="text" id="ip" style="width:170px" />
</form>
<mce:script type="text/javascript" src="ajaxrequest-m ......
/***************************by
garcon1986********************************/
Index.php:
<script type="text/javascript" src="ajax.js" ></script>
<a href="#" onclick="funphp('S')" >S</a>
<a href="for.php?url=E" >E</ ......
jquery中用ajax(貌似编码默认为utf-8)如果有中文的话 会出现乱码 下面的解决办法之一:
以下是js中的代码
classname=encodeURI($('#classname').val());
classdescription=encodeURI($('#classdescription').val());
actionArr={classname:classname,classdescription:classdescription};
$.post("product_class ......