将jquery ui可排序位置保存到数据库 [英] save jquery ui-sortable positions to DB

查看:93
本文介绍了将jquery ui可排序位置保存到数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为拥有小型网络收音机的朋友复制此页面(http://www.kissfm.ro/fresh-top-40/)的功能.该网站已在wordpress fyi中设置.

Im trying to replicate the functionality of this page (http://www.kissfm.ro/fresh-top-40/) for a friend who has a small web radio. The site is setup in wordpress fyi.

所以我的问题是,在搜索stackoverflow之后,如何根据用户输入保存/获取修订后的图表?我找到了如何保存单个提交内容的方法,但是如何根据用户选择获得最终的图表呢?

So my question is, after searching stackoverflow, how do i save/get the revised charts based on the users input? i found how to save single submittions but how do i get the final charts based on the user choice?

提前谢谢! (欢迎使用代码或链接到教程!)

Thanks in advance! (code or link to tutorial welcome!)

推荐答案

使您的HTML可排序,添加javascript,并在更新时保存到php.

make your HTML sortable, add javascript, and save to php on update.

<ul id="sortable">
    <li id="1">elem 1</li>
    <li id="2">elem 2</li>
    <li id="3">elem 3</li>
    <li id="4">elem 4</li>
</ul>

$(document).ready(function(){
    $('#sortable').sortable({
        update: function(event, ui) {
            var newOrder = $(this).sortable('toArray').toString();
            $.get('saveSortable.php', {order:newOrder});
        }
    });
});

这篇关于将jquery ui可排序位置保存到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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