如何保存动态更改的HTML? [英] How to save dynamically changed HTML?

查看:146
本文介绍了如何保存动态更改的HTML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在UL LI列表中安排了大约8个div项目.每个都有唯一的ID和特定的内容.这些项目是可排序的,我正在为此使用jquery UI.一旦用户拖放,列表项的组件位置就会更改.但是刷新页面后,我得到的是相同的HTML页面.我想在服务器上保留项目的新位置.有效的方法是什么?我可以创建HTML的克隆并将其保留在会话中,但我希望将更改保存在服务器上.元素的位置更改是特定于用户的.这就像元素的位置由用户更改,他想保存设置一样..谢谢您的提前帮助

I have around 8 div items arranged in UL LI list. Each has unique ID, and specific content.These items are sortable, I am using jquery UI for this. Once user drag and drop component position of list item changes. But after refreshing the page I am getting same HTML page. I want to retain new positions of items at server. What is the effective way to do this? I can create clone of HTML and retain it during the session but i want changes to be saved at server. The change of position of the element is specific to user.. This is something like element positions are changed by the user and he want to save the settings.. thank for the help in advance

推荐答案

不要费心检查生成的HTML.而是,只需通过AJAX将新的物料订购顺序传达回服务器即可.这可以像一个数字序列一样简单.存储它们并在下次使用它们以所需顺序创建列表.

Don't bother inspecting the resulting HTML. Rather, just communicate the new ordering of the items back to the server via AJAX. This could be as simple as a sequence of numbers. Store those and use them next time to create the list in the desired order.

这篇关于如何保存动态更改的HTML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆