【发布时间】:2012-11-14 18:29:00
【问题描述】:
所以我有一个页面,当请求时,它会更新我的数据库。例如,当我转到database_update.php 时,它只会更新数据库并且不显示任何内容。
Index.php 显示用户数据库内容。
所以我在 JavaScript 中有一个名为 update 的函数,它必须使用 AJAX 来运行此页面,并且在页面加载后(在所有查询成功运行之后)它必须加载 index.php 并向用户显示更新的页面(重新加载页面没有刷新效果)。
我的代码是这样的:
$.get('ajax_update_table.php', {
// The following is important because page saves to another table
// users nick which call update:
update: UserLogin
}, function (output) {
// The following is unimportant:
$(myDiv).html(output).show();
});
【问题讨论】:
-
您的问题具体是什么?
-
我也不确定您具体要做什么。您正在进行一个 ajax 调用,当完成后,您想要更新页面上的某些内容而不重新加载整个页面?
-
hmm,按步骤: #1 转到 index.php #2 单击调用函数 update_database 的链接 #3 在 update_database.php 中运行代码(使用 ajax 调用) #4 更新完成时(页面加载 100%)使用 ajax #5 加载 index.php 更改 pege 上的内容(步骤 #1,index.php)使用来自 ajax 的新值(新版本的 index.php)但没有可见的页面刷新(更像是追加JS,但删除旧数据并只显示新数据)希望现在更清楚:)
标签: javascript jquery ajax load