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 6799765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:53:15+00:00 2026-05-26T18:53:15+00:00

EDIT: THE PROBLEMS WERE CAUSED BY AN IMPROPERLY LOADING JQUERY LIBRARY, AN ISSUE NOT

  • 0

EDIT: THE PROBLEMS WERE CAUSED BY AN IMPROPERLY LOADING JQUERY LIBRARY, AN ISSUE NOT SPELLED OUT CLEARLY IN MY ORIGINAL QUESTION. APOLOGIES.

I’m using jquery to hide, post, then echo the results of a php query to two separate divs. I then want to be able to swap the resulting images across these divs. The first part works fine, but I’m unable to get any other jquery scripts to work on these divs (e.g. sortable, droppable, etc).

I’m new to scripting within the past few weeks. I think I need to json encode the php stuff before I send it, but I’m having trouble finding clear guidance online about how to do this. Any help much appreciated, whether either descriptive, referral to specific intro resources (e.g. not php.net), or with code itself.

I am including relevant scripts below. This one works:

<script type='text/javascript'> 
$(document).ready(function(){ 
$("#search_results").slideUp(); 
    $("#search_button").click(function(e){ 
        e.preventDefault(); 
        ajax_search(); 
    }); 
    $("#search_term").keyup(function(e){ 
        e.preventDefault(); 
        ajax_search(); 
    });    
}); 

function ajax_search(){     
  $( "#search_results").show(); 
  var search_val = $("#search_term").val();
  var search_valb = $("#search_theme").val(); 
  $.post( "./find.php", {search_term : search_val, search_theme : search_valb}, function(data){
       if (data.length>0){ 
         $( "#search_results").html(data);  
         $( ".portfolio_container").hide();
         $( ".portfolio_draggables").hide();
         $( "ul.clickable_container li").click(function(){
             $( ".portfolio_draggables").hide();
             var activeImage = $(this).find("a").attr('href'); 
             $( ".portfolio_container").show();
             $( activeImage).show(); 
             return false;           
        });  

       };
   });
};
</script>

This is the html form that I’m using.

<div id="lettersearchform" class = "lettersearchform">
        <form id="searchform" method="post">          
        <label for="search_term">Enter your word here!</label> 
        <input type="text" name="search_term[]" id="search_term" /> 
        <!--<input type="submit" value="search" id="search_button" />-->
        </form> 
</div>     

<div id="search_results"></div>

The “search_results” are generated successfully with this script:

$alpharray = array();
    while($row = mysqli_fetch_assoc($result)){      
        $alpharray[$row['letter']][] = $row;
    }

$first = $second = array();
foreach( str_split( $_POST['search_term']) as $alpha)
{ 
    $first[] = "<li><a href = '#$alpha'><img class='imgs_clickable_droppable' img src='../Letterproject/images/{$alpharray[$alpha][0]['photoPath']}' width='100' height='140'></src></a></li>";
    $editable = array("<div id='$alpha' class='portfolio_draggables'>");
    foreach ($alpharray[$alpha] as $tempvar)
    {                                              
         $editable[] = "<a href ='findall.php'><img src='../Letterproject/images/{$tempvar['photoPath']}' width='70' height='110'></src></a>";                                                         
    }   
    $editable[] = '</div>';
    $second[] = implode( '', $editable);
}

    echo '<ul id = "clickable" class="clickable_container">';
        echo implode( '', $first);
        echo '</ul>';


    echo '<div id="portfolio" class = "portfolio_container">';
        echo implode( '', $second);
    echo '</div>';

So here’s where the problem enters: This sortable script is more limited than the cross-div I want, but this type of thing won’t work.

$(function() {

    $("ul.clickable li").draggable({
        containment: 'parent',
        revert: 'invalid',
        opacity: '0.91',
        cursor: 'crosshair'
    });
    $('.clickable').sortable();
}); 

For those interested in more context, I’m using jquery to post the input from a form. A Php script matches the characters inputted to a corresponding letter image in a mysql db. It then echoes a list of these images to one div and echoes the whole portfolio of all images of that letter to another div. The idea is that a user could drag images from this second output to replace a letter image in the other div.

Thanks so much!

  • 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-05-26T18:53:15+00:00Added an answer on May 26, 2026 at 6:53 pm
    $("ul.clickable li") 
    

    does not correctly select an element with an HTML id of clickable and a class of clickable container. Either change the class of the element (which is selected with . in jQuery/CSS) or the id (which is selected with #)

    $("#clickable")
    

    should work.

    Additionally, /src is unnecessary as src is not a tag. Writing out HTML directly in PHP script is not the cleanest way of doing this. I highly recommend you check out Head First HTML/CSS or HF HTML5 to augment some of your understanding.

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

Sidebar

Related Questions

EDIT: Just to make things clear, this problem was caused by a typo in
Edit : The bug that caused this problem has been fixed. The @version tag
Edit: While this question has been asked and answered before ( 1 ), (
Many months back, I had to fix up some code that caused some problems.
EDIT:: the problem was caused due to zend route please check updates I am
I am using MVC 3 model binding in combination with JQuery serializer() to edit
[Edit: This problem applies only to 32-bit systems. If your computer, your OS and
EDIT: This problem has been solved. See below. Hey all. I'm building an iPhone
Edit 1: Uninstalled & Reinstalled Edit 2: Same problem. Seriously? Yes. I am having
Most of you probably know the following problem: You edit an HTML, view the

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.