case 'ajax':
busy = false;
$.fancybox.showActivity();
selectedOpts.ajax.win = selectedOpts.ajax.success;
ajaxLoader = $.ajax($.extend({}, selectedOpts.ajax, {
url : href,
data : selectedOpts.ajax.data || {},
error : function(XMLHttpRequest, textStatus, errorThrown) {
if ( XMLHttpRequest.status > 0 ) {
_error();
}
},
success : function(data, textStatus, XMLHttpRequest) {
var o = typeof XMLHttpRequest == 'object' ? XMLHttpRequest : ajaxLoader;
if (o.status == 200) {
if ( typeof selectedOpts.ajax.win == 'function' ) {
ret = selectedOpts.ajax.win(href, data, textStatus, XMLHttpRequest);
if (ret === false) {
loading.hide();
return;
} else if (typeof ret == 'string' || typeof ret == 'object') {
data = ret;
}
}
tmp.html( data );
_process_inline();
}
}
}));
break;我不明白为什么
selectedOpts.ajax.win = selectedOpts.ajax.success; 是否已像这样初始化,其中是否已初始化成功?其中
selectedOpts.ajax.data 是否已初始化?
在此语句中转接呼叫的位置
ret = selectedOpts.ajax.win(href, data, textStatus, XMLHttpRequest);方法体在哪里?
发布于 2012-09-24 21:57:05
我猜你不知道jquery ajax。
selectedOpts.ajax.win(href,data,textStatus,XMLHttpRequest);基本上就是jquery ajax的成功函数。您必须覆盖成功函数,这些变量由jquery ajax传递。
数据是使用jquery扩展来设置的。您必须传递ajax变量。
更新(已将注释代码移至答案中)
$("#Link").fancybox({
ajax : {
type : "POST",
data : 'mydata=test',
success : function(data, textStatus, jqXHR){
// do something on success
}
}
});https://stackoverflow.com/questions/12566212
复制相似问题