<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.0.5" -->
<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/"
	>

<channel>
	<title>Silici0 :: Blog</title>
	<link>http://www.rafaelcunha.com</link>
	<description>Php, JS, JQuery, Ajax e +++</description>
	<pubDate>Tue, 09 Mar 2010 22:05:03 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.5</generator>
	<language>en</language>
			<item>
		<title>Da Query (MySQL) para JSon</title>
		<link>http://www.rafaelcunha.com/2008/10/07/da-query-mysql-para-json/</link>
		<comments>http://www.rafaelcunha.com/2008/10/07/da-query-mysql-para-json/#comments</comments>
		<pubDate>Tue, 07 Oct 2008 20:32:53 +0000</pubDate>
		<dc:creator>silici0</dc:creator>
		
		<category>JavaScript</category>

		<category>AJAX</category>

		<category>Tutorial</category>

		<guid isPermaLink="false">http://www.rafaelcunha.com/2008/10/07/da-query-mysql-para-json/</guid>
		<description><![CDATA[Bom, como jÃ¡ Ã© comum as pessoas trabalharem com AJAX onde o envio se da para um arquivo que se conecta em um banco de dados e retorna o resultado de um Query, vou ensinar como tratar esse(s) dado(s) para retornar um Json e processar os dados sem o uso de eval(), pois como foi [...]]]></description>
			<content:encoded><![CDATA[<p>Bom, como jÃ¡ Ã© comum as pessoas trabalharem com <a href="http://pt.wikipedia.org/wiki/AJAX_%28programa%C3%A7%C3%A3o%29" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://pt.wikipedia.org/wiki/AJAX_%28programa%C3%A7%C3%A3o%29');"  class="alinks_links" onclick="return alinks_click(this);" title="Asynchronous JavaScript and XML"  style="padding-right: 13px; background: url(http://rafaelcunha.com/WordPress/wp-content/plugins/alinks/images/external.png) center right no-repeat;" rel="external">AJAX</a> onde o envio se da para um arquivo que se conecta em um banco de dados e retorna o resultado de um Query, vou ensinar como tratar esse(s) dado(s) para retornar um <a href="http://pt.wikipedia.org/wiki/JSON" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://pt.wikipedia.org/wiki/JSON');"  class="alinks_links" onclick="return alinks_click(this);" title="JavaScript Object Notation"  style="padding-right: 13px; background: url(http://rafaelcunha.com/WordPress/wp-content/plugins/alinks/images/external.png) center right no-repeat;" rel="external">Json</a> e processar os dados sem o uso de eval(), pois como foi comentado no outro <a target="_blank" title="Json populando formulario" href="http://www.rafaelcunha.com/2007/08/28/json-populando-formulario" >post</a> sobre, o eval Ã© uma funÃ§Ã£o perigosa que pode executar cÃ³digos javascript maliciosos, para isso iremos usar um parser (retirado do <a target="_blank" title="Json " href="http://www.rafaelcunha.com/json.org" >Json.org</a>).</p>
<p>Vamos ao que interessa, primeiramente vamos ver como tratar os dados de retorno de uma query, no qual precisamos criar uma array que para cada posiÃ§Ã£o teremos uma array com os valores:</p>
<div class="igBar"><span id="lphp-3"><a href="#" onclick="javascript:showCodeTxt('php-3'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-3">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$query</span>=<span style="color:#FF0000;">"SELECT * FROM clientes"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$resp</span>=<a href="http://www.php.net/mysql_query" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.php.net/mysql_query');"><span style="color:#000066;">mysql_query</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$query</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$obj</span>=<a href="http://www.php.net/array" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.php.net/array');"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">while</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$ret</span>=<a href="http://www.php.net/mysql_fetch_assoc" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.php.net/mysql_fetch_assoc');"><span style="color:#000066;">mysql_fetch_assoc</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$resp</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$obj</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#0000FF;">$ret</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.php.net/echo');"><span style="color:#000066;">echo</span></a> json_encode<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$obj</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">/*Imaginemos que o Obj tenha o seguinte conteudo:</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">Array</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">(</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">[0] =&gt; Array</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">(</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">[id] =&gt; 7</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">[usuario] =&gt; usuario</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">[nome] =&gt; Rafael</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">)</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">[1] =&gt; Array</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">(</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">[id] =&gt; 8</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">[usuario] =&gt; user</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">[nome] =&gt; Cunha</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">)</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">)</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">*/</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">/*O conteÃºdo do echo serÃ¡</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">[{&quot;id&quot;:&quot;7&quot;, &quot;usuario&quot;:&quot;usuario&quot;,&quot;nome&quot;:&quot;Rafael&quot; },</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">{&quot;id&quot;:&quot;8&quot;, &quot;usuario&quot;:&quot;user&quot;,&quot;nome&quot;:&quot;Cunha&quot;}]</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">*/</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Acima entÃ£o no final usamos a funÃ§Ã£o json_encode do PHP para passarmos nossa array para um valor representante em Json.<br />
Agora nossa funÃ§Ã£o ajax (javascript) ja recebeu os dados e o que precisamos Ã© dar um parse para passarmos para um Obj com notaÃ§Ã£o Json para podermos manipular os dados livremente, para isso precisaremos do parser que estÃ¡ escrito em JavaScript e pode ser feito o download na pÃ¡gina do Json.org:</p>
<div class="igBar"><span id="ljavascript-4"><a href="#" onclick="javascript:showCodeTxt('javascript-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span>
<div id="javascript-4">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// Imaginando que seu Ajax (funÃ§Ã£o) retorne o resultado com o nome de var data</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> myObject = JSON.<span style="color: #006600;">parse</span><span style="color: #66cc66;">&#40;</span>data<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// Pronto: para acessarmos os dados podemos utilizar o</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// myObject.id</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// myObject.usuario</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// myObject.nome</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// For roda o Objeto JSon e retorna valor</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066; font-weight: bold;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> x <span style="color: #000066; font-weight: bold;">in</span> myObject<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066;">alert</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"Meu id:Â&nbsp; "</span>+myObject<span style="color: #66cc66;">&#91;</span>x<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">id</span>+<span style="color: #3366CC;">" usuario : "</span>+myObject<span style="color: #66cc66;">&#91;</span>x<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">usuario</span>+<span style="color: #3366CC;">" nome : "</span>+myObject<span style="color: #66cc66;">&#91;</span>x<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">nome</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Poque usar o JSON.parse() ? Na verdade como dito anteriormente Ã© uma questÃ£o de seguranÃ§a, pois este parse nÃ£o executa cÃ³digos, nos livrando de problemas com scripts maliciosos, alÃ©m de ser mais rÃ¡pido do que simplesmente executar um eval(), este parse pode ser usado para executar funÃ§Ãµes em conjunto com a criaÃ§Ã£o do Obj, basta dar uma olhada na documentaÃ§Ã£o.<!--fdfb4d1367bce6e185d970169573e820--><!--ead40fb98c7f239cd5ebc5ea292c9bee--><!--fc8f38d551badb10af6b5b6cf3655107--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rafaelcunha.com/2008/10/07/da-query-mysql-para-json/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ferramentas para desenvolver</title>
		<link>http://www.rafaelcunha.com/2008/05/19/ferramentas-para-desenvolver/</link>
		<comments>http://www.rafaelcunha.com/2008/05/19/ferramentas-para-desenvolver/#comments</comments>
		<pubDate>Mon, 19 May 2008 20:19:36 +0000</pubDate>
		<dc:creator>silici0</dc:creator>
		
		<category>Informatica</category>

		<category>Trabalho</category>

		<category>JavaScript</category>

		<category>AJAX</category>

		<category>SEO</category>

		<guid isPermaLink="false">http://www.rafaelcunha.com/2008/05/19/ferramentas-para-desenvolver/</guid>
		<description><![CDATA[Bom, existe uma grande discuÃ§Ã£o sobre ferramentas para desenvolver, seja ela web-based ou nÃ£o, a grande discuÃ§Ã£o fica por conta se realmente a ferramenta ira lhe ajudar a construir o melhor cÃ³digo no melhor tempo possÃ­vel. NÃ£o irei entrar no merito no momento sobre essa discuÃ§Ã£o; estou para dizer que existem ferramentas que nÃ£o podem [...]]]></description>
			<content:encoded><![CDATA[<p>Bom, existe uma grande discuÃ§Ã£o sobre ferramentas para desenvolver, seja ela web-based ou nÃ£o, a grande discuÃ§Ã£o fica por conta se realmente a ferramenta ira lhe ajudar a construir o melhor cÃ³digo no melhor tempo possÃ­vel. NÃ£o irei entrar no merito no momento sobre essa discuÃ§Ã£o; estou para dizer que existem ferramentas que nÃ£o podem faltar na vida do webdeveloper, algumas delas estÃ£o descritas abaixo :</p>
<ul>
<li>Para nosso amigo Firefox:</li>
</ul>
<ol>
<li><a target="_blank" title="FireBug" href="https://addons.mozilla.org/pt-BR/firefox/addon/1843" onclick="javascript:pageTracker._trackPageview('/outbound/article/https://addons.mozilla.org/pt-BR/firefox/addon/1843');">Firebug </a>: Ferramenta para debugar, monitorar e editar em tempo real no site, CSS, HTML e Javascript, ferramenta muito poderosa.</li>
<li><a target="_blank" title="YSlow" href="https://addons.mozilla.org/pt-BR/firefox/addon/5369" onclick="javascript:pageTracker._trackPageview('/outbound/article/https://addons.mozilla.org/pt-BR/firefox/addon/5369');">YSlow </a>: Ferramenta que analiza o site e traz estatÃ­stica se o site esta com performace baixa ou alta, baseada nas regras do Yahoo!.</li>
<li><a target="_blank" title="HttpFox" href="https://addons.mozilla.org/pt-BR/firefox/addon/6647" onclick="javascript:pageTracker._trackPageview('/outbound/article/https://addons.mozilla.org/pt-BR/firefox/addon/6647');">HttpFox </a>: Ferramenta que monitora e analiza entrada e saÃ­da do protocolo HTTP do website, muito importante para visualizar controles em <a href="http://pt.wikipedia.org/wiki/AJAX_%28programa%C3%A7%C3%A3o%29" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://pt.wikipedia.org/wiki/AJAX_%28programa%C3%A7%C3%A3o%29');"  class="alinks_links" onclick="return alinks_click(this);" title="Asynchronous JavaScript and XML"  style="padding-right: 13px; background: url(http://rafaelcunha.com/WordPress/wp-content/plugins/alinks/images/external.png) center right no-repeat;" rel="external">Ajax</a>.</li>
<li><a target="_blank" title="Web Developer" href="https://addons.mozilla.org/pt-BR/firefox/addon/60" onclick="javascript:pageTracker._trackPageview('/outbound/article/https://addons.mozilla.org/pt-BR/firefox/addon/60');">Web Developer tool bar </a>:Â  Ja dito ateriormente neste <a target="_blank" title="Barra web developer" href="http://www.rafaelcunha.com/2007/05/28/barra-web-developer/" >post</a>, ferramenta com multiplas ferramentas para web.</li>
</ol>
<ul>
<li>Para nosso <strike>inimigo</strike> amigo IE:</li>
</ul>
<ol>
<li><a target="_blank" title="IE Developer ToolBar" href="http://www.microsoft.com/downloads/details.aspx?familyid=E59C3964-672D-4511-BB3E-2D5E1DB91038&#038;displaylang=en" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.microsoft.com/downloads/details.aspx?familyid=E59C3964-672D-4511-BB3E-2D5E1DB91038&#038;displaylang=en');">Developer ToolBar </a>: Igual ao firebug, porÃ©m com menos recursos.</li>
<li><a target="_blank" title="Multiple IES" href="http://tredosoft.com/Multiple_IE" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://tredosoft.com/Multiple_IE');">MultiplesIEs </a>: Ferramenta para poder testar o site em diversas versÃµes do IE.</li>
</ol>
<p><!--53de19e30e6036bdfe79cc42016c5463--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rafaelcunha.com/2008/05/19/ferramentas-para-desenvolver/feed/</wfw:commentRss>
		</item>
		<item>
		<title>DHTML, DOM e JavaScript DOM nÃ£o sÃ£o a mesma coisa</title>
		<link>http://www.rafaelcunha.com/2008/05/05/dhtml-dom-e-javascript-dom-nao-sao-a-mesma-coisa/</link>
		<comments>http://www.rafaelcunha.com/2008/05/05/dhtml-dom-e-javascript-dom-nao-sao-a-mesma-coisa/#comments</comments>
		<pubDate>Mon, 05 May 2008 11:11:08 +0000</pubDate>
		<dc:creator>silici0</dc:creator>
		
		<category>Informatica</category>

		<category>JavaScript</category>

		<category>AJAX</category>

		<guid isPermaLink="false">http://www.rafaelcunha.com/2008/05/05/dhtml-dom-e-javascript-dom-nao-sao-a-mesma-coisa/</guid>
		<description><![CDATA[Bom vou falar um pouco sobre conceitos, logo para apresentar para vocÃªs uma pouco o que realmente Ã© DHTML ou Dynamic HTML e DOM, o que seria esse DOM que todo mundo fala? O conceito de DHTML Ã© bem antigo, ja se usavam apartir do momento que lanÃ§aram o IE 4.0+, Netscape 7+, Mozilla e [...]]]></description>
			<content:encoded><![CDATA[<p>Bom vou falar um pouco sobre conceitos, logo para apresentar para vocÃªs uma pouco o que realmente Ã© DHTML ou Dynamic HTML e <a href="http://pt.wikipedia.org/wiki/DOM" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://pt.wikipedia.org/wiki/DOM');"  class="alinks_links" onclick="return alinks_click(this);" title="Document Object Model"  style="padding-right: 13px; background: url(http://rafaelcunha.com/WordPress/wp-content/plugins/alinks/images/external.png) center right no-repeat;" rel="external">DOM</a>, o que seria esse DOM que todo mundo fala? O conceito de DHTML Ã© bem antigo, ja se usavam apartir do momento que lanÃ§aram o IE 4.0+, Netscape 7+, Mozilla e Firefox 1.0.</p>
<p>Ã‰ a idÃ©ia de tornar a pÃ¡gina dinÃ¢mica seria a possibilidade de transformar ou mudar estrutura da pÃ¡gina sem o reload dela, mudar um tÃ­tulo, cabeÃ§alho, cor, esconder algo do usuÃ¡rio ou mostrar num passe de mÃ¡gica, sem que ele espere pelo reload da pÃ¡gina inteira novamente.</p>
<p>Mas o que tem a ver DOM e Javascript com tudo isso ? DOM significa Document Object Model (Modelo de Objetos de Documento) que seria a estrutura HTML. Ã‰ basicamente uma arvÃ³re de nÃ³s.</p>
<p>Exemplo:</p>
<div class="igBar"><span id="lhtml-6"><a href="#" onclick="javascript:showCodeTxt('html-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-6">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/div.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://december.com/html/4/element/div.html');"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"xis"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/div.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://december.com/html/4/element/div.html');"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"Y"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/div.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://december.com/html/4/element/div.html');"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"H"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
No exemplo acima temos dentro da div XIS os seguintes nÃ³s XIS>Y>H . Dizendo como Ã© nossa estrutura. A idÃ©ia do DHTML Ã© de que com o JavaScript utilizando padronizaÃ§Ã£o (CSS, xHTML / HTML) podemos fazer mudanÃ§as nesta estrutura em tempo real para facilitar a vida do usuÃ¡rio, seja deixando um texto mais escuro, mudando uma img, abrindo e fechando caixas ou atÃ© mesmo com recursos mais avanÃ§ados como o <a href="http://pt.wikipedia.org/wiki/AJAX_%28programa%C3%A7%C3%A3o%29" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://pt.wikipedia.org/wiki/AJAX_%28programa%C3%A7%C3%A3o%29');"  class="alinks_links" onclick="return alinks_click(this);" title="Asynchronous JavaScript and XML"  style="padding-right: 13px; background: url(http://rafaelcunha.com/WordPress/wp-content/plugins/alinks/images/external.png) center right no-repeat;" rel="external">AJAX</a>.</p>
<p>AbraÃ§os e boa semana ; )<!--f61d07ee8a52b0c790d1b040194c51a3--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rafaelcunha.com/2008/05/05/dhtml-dom-e-javascript-dom-nao-sao-a-mesma-coisa/feed/</wfw:commentRss>
		</item>
		<item>
		<title>JSON Populando formulÃ¡rio</title>
		<link>http://www.rafaelcunha.com/2007/08/28/json-populando-formulario/</link>
		<comments>http://www.rafaelcunha.com/2007/08/28/json-populando-formulario/#comments</comments>
		<pubDate>Tue, 28 Aug 2007 02:25:29 +0000</pubDate>
		<dc:creator>silici0</dc:creator>
		
		<category>Informatica</category>

		<category>JavaScript</category>

		<category>AJAX</category>

		<category>Tutorial</category>

		<guid isPermaLink="false">http://rafaelcunha.com/2007/08/28/json-populando-formulario/</guid>
		<description><![CDATA[JSON, o que Ã© ? Ã‰ um acrÃ´nimo para JavaScript Object Notation, serve para que ? Serve para fazer intercÃ¢mbio de dados, mais utilizado no Ajax, atualmente utilizado para retorno de dados para o AJAX, com a necessidade de popular (retornar) dados para um formulÃ¡rio.
JSON que se lÃª djeissÃ³n, pode ser utilizado em diversas linguagens, [...]]]></description>
			<content:encoded><![CDATA[<p>JSON, o que Ã© ? Ã‰ um acrÃ´nimo para JavaScript Object Notation, serve para que ? Serve para fazer intercÃ¢mbio de dados, mais utilizado no Ajax, atualmente utilizado para retorno de dados para o AJAX, com a necessidade de popular (retornar) dados para um formulÃ¡rio.</p>
<p>JSON que se lÃª djeissÃ³n, pode ser utilizado em diversas linguagens, como php, c/c++, javascript, Java, Delphi, Perl, Python, Ruby, ColdFusion e muitas outras.</p>
<p>Imaginamos que ao clicar no botÃ£o alterar dados de uma lista, queremos trazer os dados da requisiÃ§Ã£o do HTTP (Ajax) para colocalos no formulario. Para isso devemos retornar um dado do Ajax (arquivo da requisiÃ§Ã£o) em JSON.</p>
<p>Para se encapsular dados para o Json no PHP basta o seguinte:</p>
<div class="igBar"><span id="lphp-9"><a href="#" onclick="javascript:showCodeTxt('php-9'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-9">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$array</span> = <a href="http://www.php.net/array" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.php.net/array');"><span style="color:#000066;">array</span></a> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'a'</span>=&gt;<span style="color:#CC66CC;color:#800000;">1</span>,<span style="color:#FF0000;">'b'</span> =&gt; <span style="color:#CC66CC;color:#800000;">2</span>, <span style="color:#FF0000;">'c'</span> =&gt; <span style="color:#CC66CC;color:#800000;">3</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$res</span>=json_encode<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$array</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// retornando no res o seguinte:</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// {&quot;a&quot;:1, &quot;b&quot;:2, &quot;c&quot;:3 } </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Otimo, agora como devemos ler os dados do retorno no JavaScript? Essa Ã© parte mais fÃ¡cil, para converter dados do texto <a href="http://pt.wikipedia.org/wiki/JSON" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://pt.wikipedia.org/wiki/JSON');"  class="alinks_links" onclick="return alinks_click(this);" title="JavaScript Object Notation"  style="padding-right: 13px; background: url(http://rafaelcunha.com/WordPress/wp-content/plugins/alinks/images/external.png) center right no-repeat;" rel="external">JSON</a> para objetos (variavel do JS) basta usar a funÃ§Ã£o eval();</p>
<div class="igBar"><span id="ljavascript-10"><a href="#" onclick="javascript:showCodeTxt('javascript-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span>
<div id="javascript-10">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// resposta Ã© o $res do PHP, retorno dos dados</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066; font-weight: bold;">eval</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"var arr = "</span>+resposta<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// Agora temos uma array de dados em javascript</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// exemplo arr.a = 1</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// exemplo arr.b = 2</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// exemplo arr.c = 3 </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Agora basta popular o formulÃ¡rio (inputs, text area e afins) com <a href="http://pt.wikipedia.org/wiki/DOM" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://pt.wikipedia.org/wiki/DOM');"  class="alinks_links" onclick="return alinks_click(this);" title="Document Object Model"  style="padding-right: 13px; background: url(http://rafaelcunha.com/WordPress/wp-content/plugins/alinks/images/external.png) center right no-repeat;" rel="external">DOM</a> HTML. Pronto vocÃª aprendeu como JSON trabalha, o que Ã© e como utilizar, agora basta utilizar suas ideias em conjunto ao <a href="http://pt.wikipedia.org/wiki/AJAX_%28programa%C3%A7%C3%A3o%29" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://pt.wikipedia.org/wiki/AJAX_%28programa%C3%A7%C3%A3o%29');"  class="alinks_links" onclick="return alinks_click(this);" title="Asynchronous JavaScript and XML"  style="padding-right: 13px; background: url(http://rafaelcunha.com/WordPress/wp-content/plugins/alinks/images/external.png) center right no-repeat;" rel="external">Ajax</a> e construir maravilhas.<!--0fcbb6c54bd2e9469ad8baf92d695f7f--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rafaelcunha.com/2007/08/28/json-populando-formulario/feed/</wfw:commentRss>
		</item>
		<item>
		<title>JQuery - Ajax mÃ©todos</title>
		<link>http://www.rafaelcunha.com/2007/08/26/jquery-ajax-metodos/</link>
		<comments>http://www.rafaelcunha.com/2007/08/26/jquery-ajax-metodos/#comments</comments>
		<pubDate>Sun, 26 Aug 2007 23:42:06 +0000</pubDate>
		<dc:creator>silici0</dc:creator>
		
		<category>JQuery</category>

		<category>AJAX</category>

		<guid isPermaLink="false">http://rafaelcunha.com/2007/08/26/jquery-ajax-metodos/</guid>
		<description><![CDATA[Lista de mÃ©todos do JQuery para se usar o Ajax, como eu utilizei alguns vou falar sobre os outros, uma breve descriÃ§Ã£o para utilizaÃ§Ã£o, como usar vide o manual:
$.ajax( propriedades )
Abre uma pÃ¡gina remota utilizando o requeste de HTTP. Pode ser utilizado com envio de POST, GET e leitura de scripts JS e muito mais.
$.ajaxSetup [...]]]></description>
			<content:encoded><![CDATA[<p>Lista de mÃ©todos do <a href="http://jquery.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://jquery.com');"  class="alinks_links" onclick="return alinks_click(this);" title="JavaScript Framework"  style="padding-right: 13px; background: url(http://rafaelcunha.com/WordPress/wp-content/plugins/alinks/images/external.png) center right no-repeat;" rel="external">JQuery</a> para se usar o <a href="http://pt.wikipedia.org/wiki/AJAX_%28programa%C3%A7%C3%A3o%29" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://pt.wikipedia.org/wiki/AJAX_%28programa%C3%A7%C3%A3o%29');"  class="alinks_links" onclick="return alinks_click(this);" title="Asynchronous JavaScript and XML"  style="padding-right: 13px; background: url(http://rafaelcunha.com/WordPress/wp-content/plugins/alinks/images/external.png) center right no-repeat;" rel="external">Ajax</a>, como eu utilizei alguns vou falar sobre os outros, uma breve descriÃ§Ã£o para utilizaÃ§Ã£o, como usar vide o <a title="DocumentaÃ§Ã£o do Jquery" target="_blank" href="http://docs.jquery.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://docs.jquery.com');">manual</a>:</p>
<p>$.ajax( propriedades )<br />
Abre uma pÃ¡gina remota utilizando o requeste de HTTP. Pode ser utilizado com envio de POST, GET e leitura de scripts JS e muito mais.</p>
<p>$.ajaxSetup ( propriedades )<br />
Seta todas propriedades GLOBAL do request do ajax.</p>
<p>$.ajaxTimeout( time )<br />
Seta o tempo no qual ocorrerÃ¡ a espera antes da execuÃ§Ã£o da requisiÃ§Ã£o do ajax.</p>
<p>$.get( <a href="http://pt.wikipedia.org/wiki/URL" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://pt.wikipedia.org/wiki/URL');"  class="alinks_links" onclick="return alinks_click(this);" title="Uniform Resource Locator"  style="padding-right: 13px; background: url(http://rafaelcunha.com/WordPress/wp-content/plugins/alinks/images/external.png) center right no-repeat;" rel="external">url</a>, parametros, retorno da chamada )<br />
LÃª uma pÃ¡gina remota enviando os dados via GET, mandando URL, parametros sÃ£o os dados do GET e possibilidade de fazer controle de error no retorno.</p>
<p>$.getJSON( url, parametros, retorno da chamada )<br />
LÃª dados <a href="http://pt.wikipedia.org/wiki/JSON" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://pt.wikipedia.org/wiki/JSON');"  class="alinks_links" onclick="return alinks_click(this);" title="JavaScript Object Notation"  style="padding-right: 13px; background: url(http://rafaelcunha.com/WordPress/wp-content/plugins/alinks/images/external.png) center right no-repeat;" rel="external">JSON</a> utilizando requisiÃ§Ã£o HTTP.</p>
<p>$.getScript( url, retorno da chamada )<br />
LÃª e executa um script JavaScript utilizando requisiÃ§Ã£o HTTP GET.</p>
<p>$.post( ? vide outros topicos ?)</p>
<p>ajaxComplete( retorno )<br />
FunÃ§Ã£o que serÃ¡ executada apÃ³s o ajax ter completado.</p>
<p>ajaxError( retorno )<br />
FunÃ§Ã£o que serÃ¡ executada caso a requisiÃ§Ã£o falhe.</p>
<p>ajaxSend( retorno )<br />
FunÃ§Ã£o que serÃ¡ executada antes da requisiÃ§Ã£o do ajax ser enviado.</p>
<p>ajaxStop( retorno )<br />
FunÃ§Ã£o que serÃ¡ executada apÃ³s todas requisiÃ§Ãµes ajax terminarem.</p>
<p>ajaxSucess( retorno )<br />
FunÃ§Ã£o que serÃ¡ executada apÃ³s todas requisiÃ§Ãµes ajax forem bem sucedidas.</p>
<p>load( url, parametros, retorno )<br />
LÃª um arquivo HTML e injeta isto ao <a href="http://pt.wikipedia.org/wiki/DOM" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://pt.wikipedia.org/wiki/DOM');"  class="alinks_links" onclick="return alinks_click(this);" title="Document Object Model"  style="padding-right: 13px; background: url(http://rafaelcunha.com/WordPress/wp-content/plugins/alinks/images/external.png) center right no-repeat;" rel="external">DOM</a>.</p>
<p>EntÃ£o estÃ£o ae todas ou pelos menos algumas possibilidades que o JQuery lhe da para trabalhar com AJAX, espero que ajude a organizar um pouco as idÃ©ias e melhorar na produÃ§Ã£o, ganhar um pouco em cÃ³digo, pois pelo que eu vi, em vez de usarem os mÃ©todos prontos o pessoal tem usado DOM e as vezes retornado problemas diante do I.E.<!--1b129a99e63b081ffc17df18e4ca692f--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rafaelcunha.com/2007/08/26/jquery-ajax-metodos/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Entenda o que Ã© AJAX !</title>
		<link>http://www.rafaelcunha.com/2007/06/15/entenda-o-que-e-ajax/</link>
		<comments>http://www.rafaelcunha.com/2007/06/15/entenda-o-que-e-ajax/#comments</comments>
		<pubDate>Fri, 15 Jun 2007 12:05:18 +0000</pubDate>
		<dc:creator>silici0</dc:creator>
		
		<category>Informatica</category>

		<category>Trabalho</category>

		<category>JavaScript</category>

		<category>AJAX</category>

		<guid isPermaLink="false">http://rafaelcunha.com/2007/06/15/entenda-o-que-e-ajax/</guid>
		<description><![CDATA[Muito comum eu ver por ai ou me perguntarem se eu tenho funÃ§Ã£o X em AJAX ou como se faz coisa Y em AJAX, sendo que muitas vezes o X e/ou Y estÃ£o longe de ser uma sistemÃ¡tica de AJAX, por isso hoje vou escrever esse texto para finalmente tirar todas dÃºvidas sobre o que [...]]]></description>
			<content:encoded><![CDATA[<p>Muito comum eu ver por ai ou me perguntarem se eu tenho funÃ§Ã£o X em <a href="http://pt.wikipedia.org/wiki/AJAX_%28programa%C3%A7%C3%A3o%29" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://pt.wikipedia.org/wiki/AJAX_%28programa%C3%A7%C3%A3o%29');"  class="alinks_links" onclick="return alinks_click(this);" title="Asynchronous JavaScript and XML"  style="padding-right: 13px; background: url(http://rafaelcunha.com/WordPress/wp-content/plugins/alinks/images/external.png) center right no-repeat;" rel="external">AJAX</a> ou como se faz coisa Y em AJAX, sendo que muitas vezes o X e/ou Y estÃ£o longe de ser uma sistemÃ¡tica de AJAX, por isso hoje vou escrever esse texto para finalmente tirar todas dÃºvidas sobre o que Ã© ou nÃ£o esse tal de AJAX.</p>
<p>AJAX Ã© a abreviaÃ§Ã£o do <strong>Asynchronous Javascript And <a href="http://pt.wikipedia.org/wiki/XML" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://pt.wikipedia.org/wiki/XML');"  class="alinks_links" onclick="return alinks_click(this);" title="eXtensible Markup Language"  style="padding-right: 13px; background: url(http://rafaelcunha.com/WordPress/wp-content/plugins/alinks/images/external.png) center right no-repeat;" rel="external">XML</a></strong> assÃ­ncrono de  JavaScript e XML (nÃ£o necessÃ¡rio sendo XML), mas esse assincrono por ae o que Ã©?  Ã‰ a idÃ©ia de 'liberdade',  a base de  vocÃª fazer uma  requisiÃ§Ã£o ao servidor e esperar, porÃ©m enquanto vocÃª espera vocÃª esta livre para fazer outras coisas. Exemplo: Se vocÃª requisitar se um usuÃ¡rio Ã© valido ou nÃ£o vocÃª pode enquanto isso, colocar uma img de loading na tela enquanto nÃ£o vem a 'reposta'. Assim que a resposta chegar vocÃª toma as devidas decisÃµes.</p>
<p><a target="_blank" href="http://www.imagereward.com/Imageviewer.aspx?image=NDQyMjc%3d"></p>
<div style="text-align: center"><img border="0" src="http://www.imagereward.com/images2/public/2007/166/7//ajax-perth-australia-web-development_s.gif" /></div>
<p></a>Hmmm... esta comenÃ§ando e entender? EntÃ£o ja de base nÃ³s temos em mente que todo AJAX Ã© um requisiÃ§Ã£o ao servidor, sem tempo de resposta, (geralmente Ã© rÃ¡pido) e na qual podemos fazer aÃ§Ãµes enquanto nÃ£o chega a resposta.</p>
<p>E o XML, seria a idÃ©ia de que toda resposta da requisiÃ§Ã£o deveria ter, porÃ©m nos podemos trazer tranquilamente respostas em outros formatos conteÃºdo HTML, documento em XML, simplesmente algum 'texto' ou notaÃ§Ã£o de objeto de JavaScript (famoso <a href="http://pt.wikipedia.org/wiki/JSON" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://pt.wikipedia.org/wiki/JSON');"  class="alinks_links" onclick="return alinks_click(this);" title="JavaScript Object Notation"  style="padding-right: 13px; background: url(http://rafaelcunha.com/WordPress/wp-content/plugins/alinks/images/external.png) center right no-repeat;" rel="external">JSON</a>). EntÃ£o quando receber essa requisiÃ§Ã£o, trabalhar com esses dados. Todos esses tipos de resposta de requisiÃ§Ã£o referen-se a tecnologia ou mÃ©todo AJAX.</p>
<p><a target="_blank" href="http://www.imagereward.com/Imageviewer.aspx?image=NDQyMjg%3d"></p>
<div style="text-align: center"><img border="0" src="http://www.imagereward.com/images/public/2007/166/7//interaction_s.jpg" /></div>
<p></a>Apartir entÃ£o da reposta vocÃª pode atualizar ou modificar o conteÃºdo da 'pÃ¡gina' com o Modelo de Objeto do Documento (famoso <a href="http://pt.wikipedia.org/wiki/DOM" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://pt.wikipedia.org/wiki/DOM');"  class="alinks_links" onclick="return alinks_click(this);" title="Document Object Model"  style="padding-right: 13px; background: url(http://rafaelcunha.com/WordPress/wp-content/plugins/alinks/images/external.png) center right no-repeat;" rel="external">DOM</a>).</p>
<p>Com as imagens acima vocÃª ver 'desenhado' como Ã© a idÃ©ia de requisiÃ§Ã£o e resposta, com tudo isso vocÃª tem a vantagem de ter pÃ¡ginas mais dinamicas afim de melhorar o desempenho em relaÃ§Ã£o ao usuÃ¡rio. DÃºvidas? SugestÃµes? So comentar.<!--624a2dcb18aad7056c0ab4c698d2ec36--><!--1c1788e002361d2c1110bf66d61b99cd--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rafaelcunha.com/2007/06/15/entenda-o-que-e-ajax/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
