1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title></title>
- <script type="text/javascript">
- window.onload = function () {
- ajax("http://d-back.1473.cn:1337", ["selectAll","1","2"], function (r) {
- alert(r);
- });
- }
- ajax = function (url, arg, callback) {
- var arg = "mode=" + arg.join();
- var _xmr;
- //从已经存在的ajax对象中找到已经结束请求的ajax对象,重新使用,避免ajax对象没有释放,重新创建的问题。
- _xmr = findExistAjax();
- //兼容返回所有的浏览器的ajax
- _xmr = compileBrowser();
- //值兼容chrome
- var _xmr = new XMLHttpRequest();
- _xmr.open("POST", url);
- _xmr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- _xmr.send(arg);
- _xmr.onreadystatechange = function () {
- if (this.readyState == 4 && this.status == 200) {
- callback ? callback(this.resonseText) : "";
- }
- }
- }
- </script>
- </head>
- <body>
- </body>
- </html>
|