Refresh a div element with new data

  • Unknown's avatar

    Hey guys, I’ve come across another problem that I have no idea how to resolve.

    I’m currently using WordPress as my back end and would like to make a sidebar that pulls all posts and sorts them by wp categories (something like Gizmodo, but only sorting by categories). The user has the choice on which category he/she wants to sort it to.

    At the moment, I have no issues placing a dropdown menu and sorting it. But when I sort it, it goes to WordPress’s category template, which refeshes the main section as well (something I do not want to happen).

    Is there a way to just refresh the sidebar div element with the new category data and keep the main section intact?

    Here’s the test site : http://dev.theclickshop.net

    Would really appreciate your help :)

  • Unknown's avatar

    You did not specify a blog address or reason for posting when you created this topic.

    This support forum is for blogs hosted at WordPress.com. If your question is about a self-hosted WordPress blog then you’ll find help at the WordPress.org forums.

    If you don’t understand the difference between WordPress.com and WordPress.org, you may find this information helpful.

    If you forgot to include a link to your blog, you can reply and include it below. It’ll help people to answer your question.

    This is an automated message.

  • Unknown's avatar

    Ok, I solved it :D

    First, I used jquery to pull the value of the dropdown menu. Then I used .load() to load the category template with the selected value, but only pull the #feed-content div.

    Here’s the jquery code:
    $('.postform').change(function(){
    var selected = $(this).val();

    $('#feed-content').css('opacity', '0.2');
    $("#feed-content").load('/?cat='+selected+' #feed-content', function(){ $('#feed-content').css('opacity', '1'); });

    });

    .postform is the default name for dropdown menus generated by wordpress.

  • Unknown's avatar

    The above solution does us no good since we can’t do any of that here at wordpress.COM.

    You are self-hosted. You need to be over at http://wordpress.ORG/support/ as that is where self-hosted sites are supported.

  • Unknown's avatar

    I see, sorry about that. Anyways, the issue has been resolved. How do I delete this post?

  • Unknown's avatar

    Staff will come along and close it at some point, so don’t worry about it. Best of luck.

  • The topic ‘Refresh a div element with new data’ is closed to new replies.