利用Ajax实现在脚本里传值例子
来源:互联网 发布:cae软件 met 编辑:程序博客网 时间:2024/06/01 16:15
页面脚本:
function ajaxSave(URLS) {//定义一个变量用于存放XMLHttpRequest对象 var xmlhttp;//定义一个变量用于存放 从服务器返回的响应结果 var responseContext = "";if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safarixmlhttp = new XMLHttpRequest();} else {// code for IE6, IE5xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");}xmlhttp.onreadystatechange = function() {if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {responseContext = xmlhttp.responseText;alert(responseContext);}}xmlhttp.open("POST", URLS, true);xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xmlhttp.send();}
后台方法:
Boolean boolean1;String reponseText = ""; if(boolean1){ reponseText="保存成功!";}else{reponseText="保存失败!";} HttpServletResponse response = ServletActionContext.getResponse(); response.setContentType("text/plain"); response.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); out.println(reponseText); out.flush(); out.close(); return null;
- 利用Ajax实现在脚本里传值例子
- 利用Ajax实现的一个DataGrid例子
- 纯脚本ajax例子
- 纯javaScript脚本来实现Ajax功能例子一
- Ajax利用JQuery在Struts2的实现
- 利用回调实现脚本实体类和模拟Ajax
- 利用回调实现脚本实体类和模拟Ajax
- 利用Ajax的异步实现多脚本共用
- 在shell脚本中利用expect实现自动应答
- 在shell脚本中利用expect实现自动应答
- 在JSF页面利用Ajax实现局部刷新
- 利用angular 在play&scala中实现ajax
- 利用Ajax实现在页面显示局部刷新
- 利用ajax技术实现通用分页,在jsp页面呈现
- 利用.ashx实现Ajax
- 利用JSP实现Ajax
- 利用jquery写的AJAX小例子
- asp中实现AJAX例子
- SAP R/3系统概述(转载)
- ubuntu中开启ssh
- C++中堆和栈的区别,自由存储区、全局静态存储区和常量存储区
- linux putty 教程
- 厦门IT公司名单及联系方式
- 利用Ajax实现在脚本里传值例子
- 静态全局变量和全局变量的区别
- 印度恨死了缅甸这么干,谁让缅甸是中国兄弟
- Android实现识别/挂载U盘
- could not open parameter file '/opt/oracle/product/10.2/db_1/dbs/initorcl.ora
- linux中fork()函数详解(原创!!实例讲解)
- iphone开发self的用法
- 振南的znFAT(第五章_文件目录寻踪)
- 算法_动态规划总结