zoukankan      html  css  js  c++  java
  • Extjs的ajax实现

    <%@ page language="java" contentType="text/html; charset=utf-8"
        pageEncoding="utf-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Insert title here</title>
    <jsp:include flush="true" page="common/Extjs.jsp" />
    <script type="text/javascript">
    function test(){
        Ext.Ajax.request({ 
            url: '/StrutsExt/Ajax.action', 
    //         headers: { 
    //             'userHeader': 'userMsg'
    //         }, 
            params: {}, 
            method: 'GET', 
            success: function (response, options) { 
                var responseJson = Ext.JSON.decode(response.responseText); 
                //alert(responseJson.success);
                //alert(options.url);
                Ext.MessageBox.alert('成功', '从服务端获取结果: ' + response.responseText); 
                test();
            }, 
            failure: function (response, options) { 
                test();
                Ext.MessageBox.alert('失败', '请求超时或网络故障,错误编号:' + response.status); 
            },
            //callback: function (options, success, response) { 
                
            //}
    
        }); 
    }
    
    
    </script>
    </head>
    <body>
    <input type="button" value="测试" onclick="test()"/>
    </body>
    </html>
  • 相关阅读:
    java线程池
    缓存命中
    dubbo面向服务使用
    ActiveMQ
    创建证书
    struts2的运行原理以及底层的工作机制
    jdbc,mybatis,hibernate各自优缺点及区别
    struts2与springmvc的区别
    linux vi 命令编辑操作
    Linux FTP基本操作命令 ( 序列二 ftp)
  • 原文地址:https://www.cnblogs.com/smile361/p/2682873.html
Copyright © 2011-2022 走看看