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>