Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8150109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:59:08+00:00 2026-06-06T14:59:08+00:00

I have a page index.php that uses a modal to upload files. After those

  • 0

I have a page index.php that uses a modal to upload files. After those have uploaded I use the following to update my database and load in the new images to a list.

$('#sortableImages').load('../includes/sortImages.php?edit=' + edit);

Executes:

<script type="text/javascript">
$(document).ready(function(){ 

    $(function() {
        $("#sortableImages ul").sortable({ 
            opacity: 0.6, cursor: 'move', update: function() {
                var order = $(this).sortable("serialize") + '&action=updateRecordsListings';
                $.post("../albumUploader/queries/sort.php", order);
            }
         });
    });

});
</script>
echo "<ul class='revisionList'>";

                while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
                    $sortImageName = $row['OrgImageName']; 
                    $sortPath = "../data/gallery/" . $getGalleryID . "/images/album/" . $sortImageName;
                    echo "<li class='sortPhotos' id='recordsArray_{$row['id']}' >";
                    echo '<img src="'. $sortPath .'"/>';
                    echo "</li>";
                }

                echo "</ul>";

The images populate in a div #sortableImages on the index page. However it seems that I lose my method of sortable() from the js file that was originally loaded in the index.php or after the ajax request it’s not reading the js. What am I missing here?

Thanks a million.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T14:59:09+00:00Added an answer on June 6, 2026 at 2:59 pm

    When you load script from a remote page using ajax, it is important to realize that the ready event has already occured in page you are loading into.

    This means that code wrapped in $(function(){}) will fire as soon as it is received. If that code preceeds the html it refers to, it will not find that html, as it doesn’t exist yet.

    If you move the same code below the html it refers to, it will fire after the html exists and therefore will find it.

    EDIT: My answer presumes that all the code shown after “Executes:” in OP is contained in remote page

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function that I use on index.php page and I would like
I have a sample page that uses 2 PHP files and a MySql database,
I have the following scenario. I have a index.php page with the following JQuery
I have a page, index.php, that shows information based on a mysql db. There
I have a generic index.php that uses $_GET variables to display different pages, but
Usually I have the main page (index.php) that include header/footer/menu and the content of
I have the following code in a page (index.php), it's composed by just two
I have a page index.php where i have a link called add_users.php. In add_users.php,
I have an index page index.php , and when the user clicks on a
I have my index.php page and just afrer my header i want to include

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.