EXTjs 的ajax返回的response对应url中的数据,

EXT.AJAX.request,

如果url是文本文件,而且文本文件有字符串或者别的数据,

最后自动返回response,并且response.responseText就是文本文件的内容.



<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=gbk">
       <link rel="stylesheet" type="text/css" href="ext3js/ext-all.css" />
    <link rel="stylesheet" type="text/css" href="ext3js/examples.css" />
     <script type="text/javascript" src="ext3js/ext-base.js"></script>
      <script type="text/javascript" src="ext3js/ext-all.js"></script>
      <script type="text/javascript" src="ext3js/localXHR.js"></script>
        <title>10.store</title>
        <script type="text/javascript">

function doSuccess(response) {
    this.dom.value = response.responseText;
}

 Ext.onReady(function(){
    Ext.get('button').on('click', function(){
        var text = Ext.get('text');
        Ext.lib.Ajax.request(
            'POST',
            'myjs/ajax.text',
            {success:doSuccess,scope:text},
            'param=' + encodeURIComponent(text.dom.value)
        );
    });
});
        </script>
    </head>
    <body>
        <script type="text/javascript" src="ext3js/examples.js"></script>
        <input type="text" name="text" id="text">
        <input type="button" name="button" id="button" value="button">
    </body>
</html>



posted @ 2011-07-19 12:06  飞扬的薰衣草  阅读(252)  评论(0编辑  收藏  举报