troubleshooting Question

JQuery Refresh DIV after sorting (Code provided)

Avatar of Wayne Barron
Wayne BarronFlag for United States of America asked on
ASPjQueryAJAX
8 Comments1 Solution14 ViewsLast Modified:
Hello, All.

I am working with a JQuery Sorting table.
Love it, works great.
However, I am trying to make it do an auto-update-refresh, so it will get the new sorting numbers as they are entered into the database.

The first time it is run, it works. However, anytime after the first time, it will not auto-update-refresh the data in the table.

This is what I am calling when the sorting is over.
<table id="SongList">

Open in new window

This is what I am using.


    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>

<script type="text/javascript">
$(function() {
   $("#sortable").sortable(    
      {opacity: 0.7,
       revert: true,
       scroll: true, 
      cursor: 'crosshair', 
      update : function () { 
               var order = $('#sortable').sortable('serialize'); 
         //alert(order);
               $("#info").load("Insert.asp?"+order);
            //Refresh when we are done sorting, to get the new ordered list
             $('#SongList').load('SongList.asp?DJID=1&chID=1');
         }
   });
});
</script>
                    
<div id="info">Order your songs</div>
        <table class="table table-bordered" id="SongList" style="width:420px; font-size:10pt; color:#CCC;">
            <tr>
                <th style="width:5%;">#</th>
                <th style="width:15%;">Order</th>
                <th style="width:100%;">Song Title</th>
                <th style="width:20%;">Artist</th>
            </tr>
            <tbody class="row_position" id="sortable">
         
                <tr id="favItem_49" class="dragit">
                <td style="border-bottom:1px double #CCC;">0</td>
                    <td style="border-bottom:1px double #CCC;">49</td>
                    <td style="border-bottom:1px double #CCC;">Strutter</td>
                    <td style="border-bottom:1px double #CCC;">KISS</td>
                </tr>
            
                <tr id="favItem_48" class="dragit">
                <td style="border-bottom:1px double #CCC;">1</td>
                    <td style="border-bottom:1px double #CCC;">48</td>
                    <td style="border-bottom:1px double #CCC;">Do You Love Me</td>
                    <td style="border-bottom:1px double #CCC;">KISS</td>
                </tr>

                <tr id="favItem_37" class="dragit">
                <td style="border-bottom:1px double #CCC;">2</td>
                    <td style="border-bottom:1px double #CCC;">37</td>
                    <td style="border-bottom:1px double #CCC;">Who Wants to be Lonely</td>
                    <td style="border-bottom:1px double #CCC;">KISS</td>
                </tr>
            
                <tr id="favItem_65" class="dragit">
                <td style="border-bottom:1px double #CCC;">3</td>
                    <td style="border-bottom:1px double #CCC;">65</td>
                    <td style="border-bottom:1px double #CCC;">Tears are Falling</td>
                    <td style="border-bottom:1px double #CCC;">KISS</td>
                </tr>
            
                <tr id="favItem_43" class="dragit">
                <td style="border-bottom:1px double #CCC;">4</td>
                    <td style="border-bottom:1px double #CCC;">43</td>
                    <td style="border-bottom:1px double #CCC;">Love 'em and Leave 'em</td>
                    <td style="border-bottom:1px double #CCC;">KISS</td>
                </tr>
            
</tbody>
</tr>
</table>

Open in new window


ASKER CERTIFIED SOLUTION
David H.H.Lee
Digital Marketing (Hospitality)
Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 8 Comments.
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>

Mike

Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 8 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004