使用Dojo实现页面不刷新提交数据
使用Dojo实现页面不刷新提交数据
<div id=temp></div><button id="changeME">changeme</button>
<form name="add">
<input type="text" name="a"/>
<input type="text" name="b"/>
</form>
<script>
dojo.addOnLoad(function(){
var changeMeButton=dojo.byId("changeME");
//给按钮添加点几事件
dojo.event.connect(changeMeButton,"onclick",function(){
//调用ajax
dojo.io.bind({
http://writeblog.csdn.net/Editor/FCKeditor/editor/%22/crifa/BusinessInfoList.do",
content: {a: 1, b: 2}, //url参数方式
formNode:add //表单方式
mimeType:"text/plain",
load:function(type,data,evt){
alert(data);
},
error:function(type,data,evt){
alert(data);
}
});});
});
</script>
BusinessInfoList.java
response.setCharacterEncoding("utf-8");
PrintWriter out=response.getWriter();
out.print(a+b);
return null;
一定要返回null
PrintWriter out=response.getWriter();
out.print(a+b);
return null;
一定要返回null