<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">

<channel>
	<title>Werner Creixell &#187; cross-domain</title>
	<atom:link href="http://profesores.elo.utfsm.cl/~wcreixell/index.html/?feed=rss2&#038;tag=cross-domain" rel="self" type="application/rss+xml" />
	<link>http://profesores.elo.utfsm.cl/~wcreixell</link>
	<description>Personal web page</description>
	<lastBuildDate>Fri, 20 Mar 2026 13:06:49 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.6.1</generator>
<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.0/cl/</creativeCommons:license>		<item>
		<title>Twitter Searchs</title>
		<link>http://profesores.elo.utfsm.cl/~wcreixell/?p=141</link>
		<comments>http://profesores.elo.utfsm.cl/~wcreixell/?p=141#comments</comments>
		<pubDate>Wed, 16 Jun 2010 20:09:50 +0000</pubDate>
		<dc:creator>Werner Creixell</dc:creator>
				<category><![CDATA[SeminarioII]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[cross-domain]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[jacascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://profesores.elo.utfsm.cl/~wcreixell/?p=141</guid>
		<description><![CDATA[In Seminario II the students were challenged to make a web page that displays a Twitter search. The &#8220;#chi&#8221; or &#8220;#worldcup&#8221; hash-tag search is performed and the results dynamically displayed. Dominique Naser solution, using jQuery, can be found here (gracias Dominique). First a simple form to input the search. &#60;html> &#60;head> &#60;meta http-equiv="Content-type" content="text/html; charset=utf-8"> [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>In Seminario II the students were challenged to make a web page that displays a Twitter search. The &#8220;#chi&#8221; or &#8220;#worldcup&#8221; hash-tag search is performed and the results dynamically displayed.</p>
<p>Dominique Naser solution, using <a href="http://jquery.com/">jQuery</a>, can be found <a href="http://profesores.elo.utfsm.cl/~wcreixell/domnique/index.php">here</a> (gracias Dominique).</p>
<p>First a simple form to input the search.</p>
<pre name="code" class="html">
&lt;html>
  &lt;head>
    &lt;meta http-equiv="Content-type" content="text/html; charset=utf-8">
    &lt;title>Buscador de Hashtags&lt;/title>
  &lt;/head>
  &lt;body>
        &lt;h2>Buscador&lt;/h2>
    &lt;form action="busca.php" method="post">
                &lt;input name="busqueda" type="text" size="50" style="text-align:left" />
                &lt;input name="" type="submit" size="10" value="Busca!" />&lt;br>
        &lt;/form>
  &lt;/body>
&lt;/html>
</pre>
<p>The Html file where the search and the results display is performed.</p>
<pre name="code" class="html">
&lt;!DOCTYPE HTML>

&lt;html>

  &lt;head>

    &lt;meta http-equiv="Content-type" content="text/html; charset=utf-8">

    &lt;title>Buscador de Hashtags&lt;/title>

	        &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js">&lt;/script>

        &lt;script type="text/javascript" src="http://github.com/malsup/corner/raw/master/jquery.corner.js?v2.09">&lt;/script>



	&lt;script>

	const MAX_RESULTS= 20;

function twitter_search() {

	var url = 'http://search.twitter.com/search.json?callback=?';

	// Iterating over the different search columns

	$('.twitter_search').each(function() {

		var container = $(this);

		// Search terms are specified in the 'title' attribute

		var search = container.attr('title');

		if (search) {

			var since_id = 0;

			if (container.children().length) {

				// Retrieve results since this id

				since_id = container.children(':first').attr('id').replace('#', '%23');

			}

			// Request the results

			$.getJSON(url, {'q': search, 'since_id': since_id}, function(data) {

				// Processing those results, if any

				if (data.results.length) {

					for (i in data.results.reverse()) {

						var r = data.results[i];

						// Creating the result container

						var div = $('&lt;div id="#' + r.id + '">&lt;/div>');

						// Don't show this element now

						div.hide();

						// Adding some styles through .twitter_result

						div.addClass('twitter_result');

						// Adding user's image

						div.append('&lt;img src="' + r.profile_image_url + '" alt="' + r.from_user + '" />');

						// Adding username

						div.append('&lt;a href="http://twitter.com/' + r.from_user + '">' + r.from_user + '&lt;/a>');

						// Adding tweet

						div.append('&lt;span>' + r.text + '&lt;/span>');

						// Adding corners

						div.corner();

						// Adding this result to the main container

						container.prepend(div);

						// Effect

						div.slideDown('slow');

					}

				}

				// Removing old tweets

				if (container.children().length > MAX_RESULTS) {

					// Negative index

					to_remove = MAX_RESULTS - container.children().length

					container.children().slice(to_remove).each(function() {

						$(this).slideUp();

					});

				}

			});

		}

	});

};

 

$(document).ready(function() {

	// Initial search 

	twitter_search();

	// Refresh the results every 5 seconds

	setInterval("twitter_search();", 5000);

});

	&lt;/script>

  &lt;/head>

  &lt;body>

	&lt;h2>Resultado&lt;/h2>

		

		&lt;div class="twitter_search" title="&lt;?php echo $_POST["busqueda"]; ?>">&lt;/div>	



  &lt;/body>

&lt;/html>

</pre>
<p>Diego Acevedo, used a <a href="http://jquery.com/">jQuery</a> plugin <a href="http://juitter.com">Juitter</a> (gracias Diego). You can found his solution <a href="http://profesores.elo.utfsm.cl/~wcreixell/diego/index.html">here</a></p>
<p>Both solutions  by pass the cross-domain restriction imposed by the browser.</p>
]]></content:encoded>
			<wfw:commentRss>http://profesores.elo.utfsm.cl/~wcreixell/?feed=rss2&#038;p=141</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
