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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:24:33+00:00 2026-05-18T02:24:33+00:00

Okay, so I’m trying to create a Order Posts by Type using jQuery JSON

  • 0

Okay, so I’m trying to create a “Order Posts by Type” using jQuery JSON to get the data… All the post types works in Chrome, Safari, FF. But in IE, video / audio posts will not display (perhaps something to do with the embedding?) when I filter through the posts using JSON.

Does anyone have a clue what’s going on?! Here’s the code:

<script>
  $('#order_by ul li').find('a').click(function() {
  var postType = this.className;
  var count = 0;
  byCategory(postType);
  return false;

  function byCategory(postType, callback) {
    $.getJSON('{URL}/api/read/json?type=' + postType + '&callback=?', function(data) {
    var article = [];
     $.each(data.posts, function(i, item) {
     // i = index
     // item = data for a particular post
     switch(item.type) {
     case 'photo':
     article[i] = '<div class="post_wrap"><div class="photo"><a href="' 
         + item.url 
       + '" title="View Full Post" class="type_icon"><img src="http://static.tumblr.com/ewjv7ap/0yplawef6/link_photo.png" /></a><a href="' 
       + item.url 
       + '"><img src="' 
       + item['photo-url-1280'] 
       + '"alt="image" /></a></div></div>';
     count = 1;
     break;
     case 'video':
     article[i] = '<div class="post_wrap"><div class="video"><a href="' 
       + item.url 
       + '" title="View Full Post" class="type_icon"><img src="http://static.tumblr.com/ewjv7ap/FWAlawenw/link_video.png" /></a><span><br />' 
       + item['video-player'] 
       + '</span><div class="video_desc">' 
       + item['video-caption'] 
       + '</div></div></div>';
     count = 1;
     console.log(article[i]);
     break;
     case 'audio':
     article[i] = '<div class="post_wrap"><div class="audio"><a href="' 
         + item.url 
       + '" title="View Full Post" class="type_icon"><img src="http://static.tumblr.com/ewjv7ap/e8Zlawemi/link_audio.png" /></a><h2 class="heading"><a href="' 
       + item.url + '">' 
       + item['id3-artist'] 
       +' - ' 
       + item['id3-title'] 
       + '</a></h2><div class="player"><br />' 
       + item['audio-player']
       + '<p>' + item['id3-artist'] + ' - ' + item['id3-title'] + '</p>'
       + '<p>' + item['audio-plays'] + ' plays</p>' 
       + '</div><div class="audio_desc">' 
       + item['audio-caption'] 
       + '</div><div class="clear"></div></div></div>';
     count = 1;
     break;
     case 'regular':
     article[i] = '<div class="post_wrap"><div class="regular"><a href="' 
         + item.url 
       + '" title="View Full Post" class="type_icon"><img src="http://static.tumblr.com/ewjv7ap/LH3laweb7/link_text.png" /></a><h2 class="heading"><a href="' 
       + item.url 
       + '">' + item['regular-title']
       + '</a><div class="description_container">'
       + item['regular-body'] 
       + '</div></div></div>';
     count = 1;
     break;
     case 'quote':
     article[i] = '<div class="post_wrap"><div class="quote"><a href="' 
         + item.url 
       + '" title="View Full Post" class="type_icon"><img src="http://static.tumblr.com/ewjv7ap/1Lwlaweh7/link_quote.png" /></a><blockquote>' 
       + item['quote-text']
       + '</blockquote><cite>- '
       + item['quote-source'] 
       + '</cite></div></div>';
     count = 1;
     break;
     case 'conversation':
     article[i] = '<div class="post_wrap"><div class="chat"><a href="' 
         + item.url 
       + '" title="View Full Post" class="type_icon"><img src="http://static.tumblr.com/ewjv7ap/NZ9lawekt/link_chat.png" /></a><h2 class="heading"><a href="' 
       + item.url 
       + '">' + item['conversation-title']
       + '</a></h2></div></div>';
     count = 1;
     break;
     case 'link':
     article[i] = '<div class="post_wrap"><div class="link"><a href="' 
         + item.url 
       + '" title="View Full Post" class="type_icon"><img src="http://static.tumblr.com/ewjv7ap/G1zlaweir/link_link.png" /></a><h2 class="heading"><a href="' 
       + item['link-url'] 
       + '">' + item['link-text']
       + '</a></h2></div></div>';
     count = 1;
     break;
     default:
     alert('No Entries Found.');
     };
     }) // end each

     if (!(count == 0)) {
     $('#main_content')
      .fadeOut('fast')
      .html('<div class="post_wrap"><div class="regular"><h2 class="heading">Displaying ' 
      + postType 
      + ' Posts Only</h2></div></div>'
      + '<div class="post_wrap"' 
      + article.join('') 
      + '</div>'
      ).fadeIn('fast')

              $('div.video').each(function() {
       var video_container_height = $(this).innerHeight();
          video_container_height = (video_container_height - 60)

      $(this).children('div.video_desc').css(
        {'position': 'absolute',
        'top': '40px',
        'right': '20px',
        'width': '380px',
        'height': video_container_height}
       ).jScrollPane({
        verticalGutter: 25
       });
      }); 







     $('div.audio div.audio_desc').each(function() {
        var container_width = $('div.audio').outerWidth(true);
      var player_width = $('div.audio div.player').outerWidth(true);
      var audio_desc_width = (container_width - player_width);

      $(this).css(
       {'position': 'absolute',
       'top': '75px',
       'right': '20px',
       'height': '125px',
       'width': (audio_desc_width - 50 /*The size of the left and right margin*/)})
      .jScrollPane({
       verticalGutter: 25
      });
     }); 


     } else {

     $('#main_content')
      .fadeOut('fast')
      .html('<div class="post_wrap"><div class="regular"><h2 class="heading">Whoops! There are no ' 
      + postType 
      + ' Posts To Display</h2></div></div>'
      ).fadeIn('fast')
     } // end IF

   }); // end getJSON
   }; // end byCategory
    });  // end click   


  </script>

To check out the live version, head on over to http://minimus.tumblr.com

  • 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-18T02:24:34+00:00Added an answer on May 18, 2026 at 2:24 am

    I think you problem is caused by a tiny error at line 1690:

    $('#main_content')
        .fadeOut('fast')
        .html('<div class="post_wrap"><div class="regular"><h2 class="heading">Displaying '
            + postType
            + ' Posts Only</h2></div></div>'
            + '<div class="post_wrap"' // line 1690: you are missing a '>'
            + article.join('')
            + '</div>'
        ).fadeIn('fast')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, I've looked all over the internet for a good solution to get PHP
Okay, so I'm doing my first foray into using the ADO.NET Entity Framework. My
Okay, so I'm running a small test webserver on my private network. I've got
Okay so im working on this php image upload system but for some reason
Okay, here's the scenario. I have a utility that processes tons of records, and
Okay, I've seen but haven't programmed in C# before. You can assume I'm competent
Okay, so this probably sounds terribly nefarious, but I need such capabilities for my
Okay, so I'm making a table right now for Box Items. Now, a Box
Okay. I know this looks like the typical Why didn't he just Google it
Okay, we know that the following two lines are equivalent - (0 == i)

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.