原生ajax request: //===================Ajax Frame Start====================================== var xmlRequest=null; //Send Ajax Request function ajaxRequest(url){ xmlRequest = null; if(window.ActiveXObject){ xmlRequest = new ActiveXObject("Microsoft.XMLHTTP"); }else{ xmlRequest = new XMLHttpRequest(); } //'GET',URL asynchronous xmlRequest.open("GET", url, true); xmlRequest.onreadystatechange=invoke; xmlRequest.send(null); } //Callback Method For Ajax Request function invoke(){ if(xmlRequest != null && xmlRequest.readyState == 4) { if (xmlRequest.status == 200) { parse(xmlRequest); } else { alert("Ajax call failed!"); } } } //Parse XML For Ajax Request function parse(xmlRequest){ var xmlDoc = xmlRequest.responseXML; var message = xmlDoc.getElementsByTagName("Message")[0].childNodes[0].nodeValue; var errors = xmlDoc.getElementsByTagName("Error"); if(errors.length!=0){ for(var i=0;i<errors.length;i++){ message = message+"\n"+errors[i].childNodes[0].nodeValue; } } alert(message); } //===================Ajax Frame End====================================== Example: html call BW, skip J2EE framework. <!DOCTYPE HTML> <head><script> calculate=function(){ var a = document.getElementById("007").value; var b = document.getElementById("009").value; var c = document.getElementById("sel_op").value; var Host = ""; var Post = "" if(verify(a)&&verify(b)){ try { var posturl = encodeURI("http://10.114.206.147:40252/myself/intfProcess_Definition-service.serviceagent/portTypeEndpoint1"); var requestXml = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:sch=\"http://www.tibco.com/schemas/test/myself/Schema.xsd\">" + "<soapenv:Header/>" + "<soapenv:Body>" + "<sch:root>" + "<sch:valueA>" + Number(a) + "</sch:valueA>" + "<sch:valueB>" + Number(b) + "</sch:valueB>" + "<sch:po>" + c + "</sch:po>" + "</sch:root>" + "</soapenv:Body>" + "</soapenv:Envelope>"; var xmlHttpReq = false; var self = this; if (window.XMLHttpRequest) { self.xmlHttpReq = new XMLHttpRequest(); }else if (window.ActiveXObject) { self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); } self.xmlHttpReq.open('POST', posturl, true); self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); self.xmlHttpReq.setRequestHeader('SOAPAction', '/myself/intfProcess_Definition-service.serviceagent/portTypeEndpoint1/Process_sp_DefinitionOp'); self.xmlHttpReq.onreadystatechange = function() { console.log(self.xmlHttpReq.readyState); if (self.xmlHttpReq.readyState == 4) { console.log(self.xmlHttpReq.status); if (self.xmlHttpReq.status == 200) { var strResponse= self.xmlHttpReq.responseText; console.log('strResponse='+strResponse); parse(self.xmlHttpReq); } } } self.xmlHttpReq.send(requestXml); } catch (e) { alert(e); } }else{ alert("Pls enter a valid number!"); } } function parse(xmlRequest){ var xmlDoc = xmlRequest.responseXML; var result = xmlDoc.getElementsByTagName("ns0:result")[0].childNodes[0].nodeValue; document.getElementById("010").value= result; } var verify = function(value){ if(value==''||value==undefined){ return false; } return true; } </script> </head> <body> <div style="padding: 30px; border:1px solid blue; width:300px;"> <table> <tr> <th colspan='5' align="left">Calculation: A+B=?</th> </tr> <tr> <td><input style="width:75px;" onkeyup="this.value=this.value.replace(/\D/g,'')" id='007' type='text' ></td> <td> <select id="sel_op"> <option value="+">+</option> <option value="-">-</option> <option value="*">*</option> <option value="/">/</option> </select> </td> <td><input style="width:75px;" onkeyup="this.value=this.value.replace(/\D/g,'')" id='009' type='text' ></td> <td>=</td> <td><input style="width:75px;" id='010' type='text'></td> </tr> <tr> <TD></TD> <TD></TD> <td><input id='011' type='button' value='calculate' onclick='calculate()' style="background-color:cyan;" ></td> <TD></TD> <TD></TD> </tr> </table> <div> </body>
相关推荐
Using Google Web Toolkit (GWT) for Developing AJAX-Based Web Applications for the SAP NetWeaver J2EE Framework.pdf
ajax下载 ajx jquery下载 ajax jquery-1.2.6.js下载 j2ee jquery下载
NULL 博文链接:https://chun521521.iteye.com/blog/1935516
Ajax开发包Ajax开发包Ajax开发包Ajax开发包Ajax开发包Ajax开发包Ajax开发包Ajax开发包Ajax开发包Ajax开发包
NULL 博文链接:https://linwei-211.iteye.com/blog/1567277
基于J2EE的Ajax宝典.pdf.rar 基于J2EE的Ajax宝典.pdf.rar
这个包定义了 Ajax.Request 类。 假如你有一个应用程序可以通过 http://yoursever/app/get_sales?empID=1234&year=1998 与服务器通信。它返回下面这样的 XML 响应: <?xml version="1.0" encoding="utf-8" ?> ...
Ext.Ajax.request同步请求包 博文链接:https://lingf.iteye.com/blog/1195912
AJAXRequest 开发者手册AJAXRequest 开发者手册
Ajax_基于J2EE的Ajax宝典,浅显易懂,多读读书你就会发现还是回家种地好
基于J2EE的Ajax宝典 基于J2EE的Ajax宝典
该演示系统应用了Ajax、DIV+CSS3、MySQL、Servlet等主流技术。
这是《基于J2EE的Ajax宝典》中的源代码,有需要的下载来学习一下!这是02-11章的源码。
J2EE中JSON+Jquery_AJAX应用分享给大家
AjaxRequest离线开发包,即使不联网也可以使用。WEB网站开发应用Ajax包
基于J2EE的Ajax宝典
As well as focusing on client-side JavaScript, you will also learn how to work with the Browser Object Model, the Document Object Model (DOM), how to use XML and JSON as well as communicate with ...
本书详细介绍了如何将Ajax技术和J2EE应用整合在一起,如何开发Ajax应用。让Ajax技术真正融入实际应用的开发,而不是停留在Ajax层,为了Ajax而Ajax。通过认真阅读本书,读者不仅可以掌握如何开发Ajax应用,而且可以...
common pitfalls, how to write efficient AJAX code, and how to achieve functionality that is easy to integrate into current and future web applications, without requiring you to rebuild the whole ...
封装jquery ajax方法,方便调用,避免在代码中频繁使用 $.ajax({ type: 'GET', url: url, ...... )}; 统一调用公共方法即可,区分同步异步,get post!希望对大家有帮助