tags:

views:

34

answers:

2

i was just wondering if a jQuery.get() request have any difference to a normal web request. the reason why i am asking this is: i am doing a infinite scroller for my tumblr. it works well except that if there is a photoset, the returned HTML won't contain the JS/Embeds for the photoset and instead returns a raw version <p>s and <img> only. i was just wondering if it might be Tumblr detecting somehow what is requesting the data and sending back a RAW HTML version vs a JS/Embeded version. except that youtube embeds work ... hmm ... as shown below:

loaded via jQuery.get()

<div class="media">
  <div id="photoset_737156708" class="html_photoset">   
    <p><img src="http://29.media.tumblr.com/tumblr_l4lvewzfw31qbp1vqo1_500.jpg" alt="" class="photoset_photo"></p>
    <p class="photoset_caption"></p>
    <p><img src="http://25.media.tumblr.com/tumblr_l4lvewzfw31qbp1vqo2_500.jpg" alt="" class="photoset_photo"></p>
    <p class="photoset_caption"></p>
    <p><img src="http://29.media.tumblr.com/tumblr_l4lvewzfw31qbp1vqo3_500.jpg" alt="" class="photoset_photo"></p>
    <p class="photoset_caption"></p> ...

loading normally

<div class="media">
  <script type="text/javascript" language="javascript" src="http://assets.tumblr.com/javascript/tumblelog.js?16"&gt;&lt;/script&gt;
  <div id="photoset_768052613" class="html_photoset">
    <embed type="application/x-shockwave-flash" src="/swf/photoset.swf" bgcolor="#000000" quality="high" class="photoset" flashvars="showLogo=false&amp;showVersionInfo=false&amp;dataFile=/post/768052613/photoset_xml/tumblr_l50pyoByJ71qbp1vq/500" height="360" width="500"></div>
    <script type="text/javascript">    replaceIfFlash(9, "photoset_768052613", '\x3cembed type=\x22application/x-shockwave-flash\x22 src=\x22/swf/photoset.swf\x22 bgcolor=\x22#000000\x22 quality=\x22high\x22 class=\x22photoset\x22 flashvars=\x22showLogo=false\x26amp;showVersionInfo=false\x26amp;dataFile=/post/768052613/photoset_xml/tumblr_l50pyoByJ71qbp1vq/500\x22 height=\x22360\x22 width=\x22500\x22\x3e\x3c/embed\x3e')</script>
  </div> ... 
A: 

I'm not sure if you can embed JS via $.get().

However, you can load it normally and replace with swfobject or something similar.

If you want to load scripts, you can use $.getScript().

Ionut Staicu
hmm... if you were to look at the code snipplets, it seems like the structure of the request is entirely different. 1 is without the js/embeds at all and the other is embed/js without the `<p>`s and `<img>`s
jiewmeng
+2  A: 

It would add an additional X-Requested-With: XMLHttpRequest HTTP header to the request.

Darin Dimitrov