dongzhenyin2001 2011-03-02 15:07
浏览 130
已采纳

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

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!

  • 写回答

1条回答 默认 最新

  • doulu1907 2011-09-13 21:17
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?