Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try changing</p> <pre><code> $.each(data, function(){ $("#sNews ul.tweets").append("&lt;li&gt;" + replaceURLWithHTMLLinks(data.text) + "&lt;/li&gt;"); </code></pre> <p>to</p> <pre><code>$.each(data, function(post, val){ $("#sNews ul.tweets").append("&lt;li&gt;" + replaceURLWithHTMLLinks(val.text) + "&lt;/li&gt;"); </code></pre> <p><strong>Edit</strong>: </p> <p>I did change one other thing but forgot to add it to the answer.</p> <pre><code>callbackParameter: "jsoncallback", </code></pre> <p>should be</p> <pre><code>callbackParameter: "callback", </code></pre> <p>Just for completeness here is a test page I did that works:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;test&lt;/title&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="jquery.jsonp-1.1.0.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready( function() { var jsonTwitterFeed = "http://twitter.com/statuses/user_timeline/dougw.json?count=3"; $.jsonp({ url: jsonTwitterFeed, data: {}, dataType: "jsonp", callbackParameter: "callback", timeout: 5000, success: function(data){ $.each(data, function(key, val){ $("#sNews ul.tweets").append("&lt;li&gt;" + replaceURLWithHTMLLinks(val.text) + "&lt;/li&gt;"); }); }, error: function(XHR, textStatus, errorThrown){ alert("ERREUR: " + textStatus); alert("ERREUR: " + errorThrown); } }); function replaceURLWithHTMLLinks(text) { var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&amp;@#\/%?=~_|!:,.;]*[-A-Z0-9+&amp;@#\/%=~_|])/ig; return text.replace(exp,"&lt;a href='$1'&gt;$1&lt;/a&gt;"); } }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="sNews"&gt; &lt;ul class="tweets"&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/body&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload