JS:
<script type="text/javascript">
function getvalue(value){
window.location.href='jsontest!returnList.action?users='+value;
}HTML:
<input id="getList" type="button" name="users" value="获取List对象" onclick="getvalue(this.value);"/>为什么我每次点button的时候总是会弹出一个下载的面版框呢? 请问如何不让弹出来。 谢谢! 很急!
<script type="text/javascript">
function getvalue(value){
window.location.href='jsontest!returnList.action?users='+value;
}HTML:
<input id="getList" type="button" name="users" value="获取List对象" onclick="getvalue(this.value);"/>为什么我每次点button的时候总是会弹出一个下载的面版框呢? 请问如何不让弹出来。 谢谢! 很急!
然后看是不是这个action里面的功能就是下载。
不是的 那里面没下载功能 那里就是对象的封装 然后把这个对象写道一个LIST里面去的~!
就行了
这个貌似不对吧
应该是 window.location.href='returnList.action?method=m?users='+value
m是你对应的action中的方法名
那怎么解决呢?
JSON代码:
//为获取List对象按钮添加鼠标单击事件
$("#getList").click(function(){
// var url = "returnList.action";
$.getJSON("jsontest!returnList.action",function(data){
//清空显示层中的数据
$("#message").html("");
//使用jQuery中的each(data,function(){});函数
//从data.userInfosList获取UserInfo对象放入value之中
$.each(data.userInfosList,function(i,value){
$("#message")
.append("<input type='checkbox' id=userId name=userId value="+value.userId+"><input type='button' id=userName name=userName value="+value.userName+">")
});
});
});
要完成此功能,你需要使用Ajax异步调用,而不能直接在浏览器中输入action路径
否则,就会出现这种情况。
如果你把这个弹出的文件下载保存的话,可以看到文件中是jsonAction返回的
key-value格式的值
我不加 onclick="getvalue(this.value);" 这个就不会出现下载的框~!