看你ajax怎么写的了试试 $.ajax.setErrorList = function(){alert('this.errorList')}
解决方案 »
- Ext多选项卡的问题
- javascript 实现搜索本地硬盘文件目录下是否存在XX.chm,如果存在打开
- jQuery 的flexigrid控件如何合并列标题?
- 百度地图公交查询的 api 【求助高手】(要分的就别进了)
- 会javascript帮下
- 不是高手不要进!!!!在线等
- 怎样限制选中复选框的数量?
- 标记"target"是什么作用?
- 如何弹出IE使窗口titlebar中的最大化按钮失效?
- <input class=aa name=a1如何改变<input>框的class属性
- form表单中action??
- 用for循环生成多个checkbox但是name都一样,这样如何去实现选择一个复选框就显示一个testarea取消一个复选框就不显示刚才的testarea
比如
function aaa()
{
this.a=0;
this.str="sdf";
}
aaa.prototype={
getdata:function(){
$.ajax({
type: "GET",
async:false,
url: g.ConfigError,
dataType: "xml",
complete: this.setErrorList
}); },
setErrorList:function(data){
this.str=data;
}
}主要作用是在获取到数据之后,将相关数据赋于本对象的属性。
{
this.a=0;
this.str="sdf";
}
aaa.prototype={
getdata:function(){
$.ajax({
type: "GET",
async:false,
url: g.ConfigError,
dataType: "xml",
complete: this.setErrorList
});
},
setErrorList:function(data){
this.str=data;
}
}
可以这样试试
getdata:function(){
this.call($.ajax);
$.ajax({
type: "GET",
async:false,
url: g.ConfigError,
dataType: "xml",
complete: this.setErrorList
});
},
而这个函数的定义必须是function fn(data){}
这样试试
getdata:function(){
this.call($.ajax);
$.ajax(jQuery.extend({
type: "GET",
async:false,
url: g.ConfigError,
dataType: "xml",
complete: this.setErrorList
},this));
},
jquery只是一个工具而已,其内部没有实现传递对象。抛开jquery,我现在是想知道一个思路,或者说是一个设计模式,如何在回调中传递对象。好像在settimeout时,函数传递对象的性质一样。