开发者

Hide information box forever after close with jquery, ajax, php, mysql

So I am wondering the best way to go about this and thought I'd get some input.

I have information boxes with close buttons on them. I am currently using jquery to hide the boxes.

The problem is, if the user closes the information box, I would like the box to stay closed forever.

I imagine I need to set up a table in the database to know whether to show the div or not. I would also like to use AJAX on the click of the close button to send the da开发者_运维知识库ta to the database.

Would this be the best solution? Thanks in advance


  • tag each div with a specific class
  • $('div.class').live('click', fncAddClick); // this is in case you do lazy load
  • function fncAddClick(e) will call an ajax function to to mark it for deletion, then after the ajax is done on .success(), have it remove the div.


When you click on close button on the information boxes, they just hide from browser but not removed from html dom element.

If you want to remove permanently from html dom then you have to use following code..

If the information box id is "informationBox" then it will accomplished by

$("#informationBox").remove();

Try this, hope this will help..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜