下面是我的代码并不复杂,我的问题在注释中解释。 您正在阅读的此代码在开发环境中完全没问题
function click($button)
{
// blablabla
$('#core').fadeOut(300, function () {
that = this;
$('.element').fadeIn(300, function () {
$(that).empty();
});
});
$.ajax({
type: 'GET',
url: some_variable,
success: function (data) {
// ----------------------------
// ----------------------------
// ----------------------------
// ----------------------------
// the line below works well in the development
// environment, which means data is injected into $('#core')
// ----------------------------
// In production environment, the line below does not work
// which means that my jquery object $('#core') is empty as if
// $('#core').html(data) is skipped and
// of course I checked that data is not empty
// ----------------------------
$('#core').html(data);
$('.element').fadeOut(300, function () {
$('#core').fadeIn(500);
});
}
});
}
jQuery(function () {
$(document).on('click', '#button', function () {
click(this);
}
});
提前致谢,