我正在尝试在 ajax 回调中重新调用文档的 ready() 函数中的代码。这可能吗?
$(document).ready(function() {
// page initialization functions
alert('hi');
});
// this gets called from a button click on the screen
function reauth() {
// logic here omitted for brevity
$.post("/Base/reauth", $("#reauthForm").serialize(), function(data) {
if (data.result != null) {
$(document).ready(); // <-- this does not invoke the alert('hi');
}
});
}