嘿,我是一个新手程序员,试图学习一些关于 js、extjs 的东西,现在我对 AJAX 请求非常陌生。我有一个旧的 extjs 代码..它制作了一个小部件窗口,并有一个按钮提醒“东西”我如何制作它,以便它从 txt 文件中提取并将“东西”的值更改为 txt 文件中的新内容???。我不知道这是否有真正的用途,我只是有点想熟悉ajax,这是我的代码。
function loadXML()
{
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
xmlhttp.open("get", "ajax_info.txt", true);
xmlhtpp.send();
}
}
}
Ext.define('ryan', {
constructor:
function(){
Ext.create('widget.window',{
//attributes
items: [{
itemId: 'button1',
xtype: 'button',
text: 'click the button',
handler: function() {
alert('stuff');
}
.... // more code
我想在项目部分的处理程序中使用 ajax。警报(当 ajax 请求发生时,东西会发生变化)