ExtStart.js- Ext.onReady(function(){
- Ext.get('OKButton').on('click', function(){
- var msg = Ext.get('msg');
- msg.load({
- url: 'exam1.php',
- params: 'name=' + Ext.get('name').dom.value,
- callback:function(){}
- text: 'Updating...'
- });
- msg.show();
- });
- });
复制代码 ExtStart.html- <!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>Introduction to Ext: Starter Page</title>
- <!-- Include YUI utilities and Ext: -->
- <script type="text/javascript" src="../adapter/yui/yui-utilities.js"></script>
- <script type="text/javascript" src="../adapter/yui/ext-yui-adapter.js"></script>
- <script type="text/javascript" src="../ext-all-debug.js"></script>
- <script type="text/javascript" src="ExtStart.js"></script>
- <!-- Include Ext stylesheets here: -->
- <link rel="stylesheet" type="text/css" href="../resources/css/ext-all.css">
- <link rel="stylesheet" type="text/css" href="../resources/css/ytheme-vista.css">
- <link rel="stylesheet" type="text/css" href="ExtStart.css">
- </head>
- <body>
- <div id="msg"></div>
- Name:<input type="text" id="name"/><br/>
- <input type="button" id="OKButton" value="OK"/>
- </body>
- </html>
复制代码 exam1.php- <?
- if(isset($_GET['name']))
- {
- echo 'From Server '.$_GET['name'];
- }
- ?>
复制代码 程序运行在apache服务器上面,想通过点击按钮,从服务器端获取客户端从文本框内输入的数据,然后添加到客户端代码中,现在问题是,element.load()无法异步获取服务器返回的数据,哪位高手解答下,感激不尽。
核心代码:- msg.load({
- url: 'exam1.php',
- params: 'name=' + Ext.get('name').dom.value,
- callback:function(){}
- text: 'Updating...'
- });
- msg.show();
复制代码 |
|