1

注文できる画像のリストがあります。このコードを使用して画像を注文します。

$(document).ready(function(){ 
    $(function() 
    {
        $("#subafbeelding ul").sortable(
        { 
            opacity: 0.6, 
            cursor: 'move', 
            update: function(){
                var order = $(this).sortable("serialize") + '&action=updateRecordsListings'; 
                $(".hoofdafbeelding").load("foo.php");
                $.post("updatevolgoorde.php", order, function(theResponse)
                {
                    $("#contentRight").html(theResponse);

                });                                                              
            }                                 
        });
    });
}); 

  $("#contentRight").html(theResponse);

div 見出しをリロードしたい。どうすればこれを作ることができますか?

4

1 に答える 1

1

あなたが取ることができる1つのオプションはあなたがページをロードするときにhtmlのコピーを作ることです。それを非表示の要素に保存し、htmlを「再ロード」するときにそれを再利用します。

このようなもの:

$("#storage").html($("#original").html());

function addEvents() {
    $("#original ul").sortable({
        opacity: 0.6,
        cursor: 'move',
        update: function () {

        }
    });
}
addEvents();

$("#reset").click(function (e) {
    e.preventDefault();
    $("#original").html($("#storage").html());
    addEvents();
});

これは次のhtmlで動作します:

<div id="original">
    <ul>
        <li>one</li>
        <li>two</li>
        <li>three</li>
    </ul>
</div>
<div id="storage"></div>
<div> 
    <a id="reset">reset</a>
</div>

これが実際の例です。

于 2013-03-11T14:21:45.777 に答える