php 回发 & Javascript:表单提交后页面刷新

发布于 2024-10-19 19:45:35 字数 831 浏览 8 评论 0原文

我有一个网页,用户可以在其中“添加文章”;当他们点击“添加文章”时,它会打开一个 iframe(弹出模式框)。

在 Iframe 中有一个带有“保存”和“取消”按钮的表单 - 我想做的是,当用户点击“保存”时,它将数据保存到数据库,然后刷新页面。

目前,当用户点击“保存”时,它会保存数据,但页面保持打开状态。知道它已保存的唯一方法是文本“添加项目”更改为“编辑项目”。

此处列出了处理整个过程的组件

用户看到并填写的“表单”代码列于此处: http://code.google.com/p/joomlaworks/source/browse/trunk/K2/components/com_k2/views/item/tmpl/form.php?r=604

我对javascript知之甚少,并且只有中等程度的 php 知识。当用户点击“保存”时,会生成回发 - 我只是不知道如何判断从哪里发送。 我在想如果我可以将以下代码放入回发中,它将执行我想要的操作:

window.parent.location.reload();

如果有人可以帮助我找出回发是从哪里生成的,以及我如何将该代码放在那里,我将不胜感激!

I have a webpage where a user can 'add an article'; when they click to 'add an article' it opens an iframe (a pop-up modal box).

In the Iframe there is a form with 'save' and 'cancel' buttons - what I'm trying to do is make it so when the user hits 'save', it will save the data to the database, and then refresh the page.

Currently when the user hits "Save" it saves the data, but the page remains open. The only way of knowing it saved is that the text "Add Item" changes to "Edit Item".

The component that handles this whole process is listed here

The 'form' code that is what the users see and fill out is listed here:
http://code.google.com/p/joomlaworks/source/browse/trunk/K2/components/com_k2/views/item/tmpl/form.php?r=604

I know very little about javascript, and only moderate knowledge of php. When the user hit's 'save', postback is generated - I just don't know how to tell from where.
I'm thinking if I could put the following code into the postback it would do what I want:

window.parent.location.reload();

If anyone can help me to figure out where the postback is being generated from, and how I put that code in there it would be greatly appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

三生一梦 2024-10-26 19:45:35

http://community.getk2.org/forum /topics/solved-adding-articles-on-the?xg_source=activity

该线程有问题的答案。我最终自己编写了代码并将其合并到 K2 组件中。

http://community.getk2.org/forum/topics/solved-adding-articles-on-the?xg_source=activity

That thread has the answer to the problem. I ended up writing code myself to incorporate into the K2 component.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文