<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ca">
	<id>http://wiki.joanillo.org/index.php?action=history&amp;feed=atom&amp;title=Ajax._Introducci%C3%B3</id>
	<title>Ajax. Introducció - Historial de revisió</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.joanillo.org/index.php?action=history&amp;feed=atom&amp;title=Ajax._Introducci%C3%B3"/>
	<link rel="alternate" type="text/html" href="http://wiki.joanillo.org/index.php?title=Ajax._Introducci%C3%B3&amp;action=history"/>
	<updated>2026-08-30T00:34:45Z</updated>
	<subtitle>Historial de revisió per a aquesta pàgina del wiki</subtitle>
	<generator>MediaWiki 1.34.2</generator>
	<entry>
		<id>http://wiki.joanillo.org/index.php?title=Ajax._Introducci%C3%B3&amp;diff=298246&amp;oldid=prev</id>
		<title>Joan: /* Utiltizar funcions de callback per reunificar codi */</title>
		<link rel="alternate" type="text/html" href="http://wiki.joanillo.org/index.php?title=Ajax._Introducci%C3%B3&amp;diff=298246&amp;oldid=prev"/>
		<updated>2022-01-18T13:57:42Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Utiltizar funcions de callback per reunificar codi&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ca&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Versió més antiga&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revisió del 13:57, 18 gen 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l37&quot; &gt;Línia 37:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Línia 37:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;title&amp;gt;AJAX amb funcions de callback&amp;lt;/title&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;title&amp;gt;AJAX amb funcions de callback&amp;lt;/title&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;script&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;script&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;function &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;loadTXT&lt;/del&gt;(obra&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;,cFunction&lt;/del&gt;) {&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;let div;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   console.log(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;cFunction&lt;/del&gt;);&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;alert&lt;/del&gt;(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;cFunction&lt;/del&gt;);&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;function init() {&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;  div = document.getElementById(&amp;quot;literatura&amp;quot;);&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;  console.log(document.getElementsByTagName(&amp;quot;button&amp;quot;).length);&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;  let buttons = document.getElementsByTagName(&amp;quot;button&amp;quot;);&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;  for (let i=0; i&amp;lt;buttons.length; i++) {&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;    console.log(buttons[i].value);&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;    buttons[i].addEventListener(&amp;quot;click&amp;quot;, &lt;/ins&gt;function&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;() {loadTXT_v2(this.value)}, false);&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;  }&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;function loadTXT_v2&lt;/ins&gt;(obra) {&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   console.log(&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;obra&lt;/ins&gt;);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;let cFunction = eval&lt;/ins&gt;(&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;obra&lt;/ins&gt;); &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;//convertim el string a una funció&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   var xhttp;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   var xhttp;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l53&quot; &gt;Línia 53:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Línia 66:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;function quijote(xhttp) {&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;function quijote(xhttp) {&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;document.getElementById(&amp;quot;literatura&amp;quot;)&lt;/del&gt;.style.backgroundColor = &amp;quot;#bbbbbb&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;div&lt;/ins&gt;.style.backgroundColor = &amp;quot;#bbbbbb&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;document.getElementById(&amp;quot;literatura&amp;quot;)&lt;/del&gt;.style.fontFamily = &amp;quot;ABeeZee&amp;quot;;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;div&lt;/ins&gt;.style.fontFamily = &amp;quot;ABeeZee&amp;quot;;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;document.getElementById(&amp;quot;literatura&amp;quot;)&lt;/del&gt;.innerHTML = &amp;quot;&amp;lt;h3&amp;gt;Quijote de la Mancha&amp;lt;/h3&amp;gt;&amp;quot; + xhttp.responseText;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;div&lt;/ins&gt;.innerHTML = &amp;quot;&amp;lt;h3&amp;gt;Quijote de la Mancha&amp;lt;/h3&amp;gt;&amp;quot; + xhttp.responseText;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;function tirant(xhttp) {&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;function tirant(xhttp) {&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;document.getElementById(&amp;quot;literatura&amp;quot;)&lt;/del&gt;.style.backgroundColor = &amp;quot;#cccccc&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;div&lt;/ins&gt;.style.backgroundColor = &amp;quot;#cccccc&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;document.getElementById(&amp;quot;literatura&amp;quot;)&lt;/del&gt;.style.fontFamily = &amp;quot;Abril Fatface&amp;quot;;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;div&lt;/ins&gt;.style.fontFamily = &amp;quot;Abril Fatface&amp;quot;;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;document.getElementById(&amp;quot;literatura&amp;quot;)&lt;/del&gt;.innerHTML = &amp;quot;&amp;lt;h3&amp;gt;Tirant lo Blanc&amp;lt;/h3&amp;gt;&amp;quot; + xhttp.responseText;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;div&lt;/ins&gt;.innerHTML = &amp;quot;&amp;lt;h3&amp;gt;Tirant lo Blanc&amp;lt;/h3&amp;gt;&amp;quot; + xhttp.responseText;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;function roldan(xhttp) {&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;function roldan(xhttp) {&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;document.getElementById(&amp;quot;literatura&amp;quot;)&lt;/del&gt;.style.backgroundColor = &amp;quot;#dddddd&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;div&lt;/ins&gt;.style.backgroundColor = &amp;quot;#dddddd&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;document.getElementById(&amp;quot;literatura&amp;quot;)&lt;/del&gt;.style.fontFamily = &amp;quot;Aclonica&amp;quot;;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;div&lt;/ins&gt;.style.fontFamily = &amp;quot;Aclonica&amp;quot;;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;document.getElementById(&amp;quot;literatura&amp;quot;)&lt;/del&gt;.innerHTML = &amp;quot;&amp;lt;h3&amp;gt;Chanson de Roldan&amp;lt;/h3&amp;gt;&amp;quot; + xhttp.responseText;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;div&lt;/ins&gt;.innerHTML = &amp;quot;&amp;lt;h3&amp;gt;Chanson de Roldan&amp;lt;/h3&amp;gt;&amp;quot; + xhttp.responseText;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;function hamlet(xhttp) {&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;function hamlet(xhttp) {&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;document.getElementById(&amp;quot;literatura&amp;quot;)&lt;/del&gt;.style.backgroundColor = &amp;quot;#eeeeee&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;div&lt;/ins&gt;.style.backgroundColor = &amp;quot;#eeeeee&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;document.getElementById(&amp;quot;literatura&amp;quot;)&lt;/del&gt;.style.fontFamily = &amp;quot;Aladin&amp;quot;;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;div&lt;/ins&gt;.style.fontFamily = &amp;quot;Aladin&amp;quot;;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;document.getElementById(&amp;quot;literatura&amp;quot;)&lt;/del&gt;.innerHTML = &amp;quot;&amp;lt;h3&amp;gt;Hamlet (Shakespeare)&amp;lt;/h3&amp;gt;&amp;quot; + xhttp.responseText;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;div&lt;/ins&gt;.innerHTML = &amp;quot;&amp;lt;h3&amp;gt;Hamlet (Shakespeare)&amp;lt;/h3&amp;gt;&amp;quot; + xhttp.responseText;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/script&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/script&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/head&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/head&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;body&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;body &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;onload=init()&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;h1&amp;gt;Obres més importants de la literatura universal:&amp;lt;/h1&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;h1&amp;gt;Obres més importants de la literatura universal:&amp;lt;/h1&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;div id=&amp;quot;formulari&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;div id=&amp;quot;formulari&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;button value=&amp;quot;quijote&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;quot; onclick=&amp;quot;loadTXT(this.value, quijote)&lt;/del&gt;&amp;quot;&amp;gt;Quijote&amp;lt;/button&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;button value=&amp;quot;tirant&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;quot; onclick=&amp;quot;loadTXT(this.value, tirant)&lt;/del&gt;&amp;quot;&amp;gt;Tirant lo Blanc&amp;lt;/button&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;button value=&amp;quot;quijote&amp;quot;&amp;gt;Quijote&amp;lt;/button&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;button value=&amp;quot;roldan&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;quot; onclick=&amp;quot;loadTXT(this.value, roldan)&lt;/del&gt;&amp;quot;&amp;gt;Chanson de Roldan&amp;lt;/button&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;button value=&amp;quot;tirant&amp;quot;&amp;gt;Tirant lo Blanc&amp;lt;/button&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;button value=&amp;quot;hamlet&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;quot; onclick=&amp;quot;loadTXT(this.value, hamlet)&lt;/del&gt;&amp;quot;&amp;gt;Hamlet&amp;lt;/button&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;button value=&amp;quot;roldan&amp;quot;&amp;gt;Chanson de Roldan&amp;lt;/button&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;button value=&amp;quot;hamlet&amp;quot;&amp;gt;Hamlet&amp;lt;/button&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;div id=&amp;quot;literatura&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;div id=&amp;quot;literatura&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l94&quot; &gt;Línia 94:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Línia 108:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Per fer funcionar el codi necessites 4 fitxers de text: ''quijote.txt'', ''tirant.txt'', ''roldan.txt'' i ''hamlet.txt''&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Per fer funcionar el codi necessites 4 fitxers de text: ''quijote.txt'', ''tirant.txt'', ''roldan.txt'' i ''hamlet.txt''&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Fixem-nos en &lt;/del&gt;la &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;instrucció:&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Utilitzem &lt;/ins&gt;la &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;funció '''eval&lt;/ins&gt;()&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;''' per convertir la &lt;/ins&gt;cadena de text ''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;quixot'' a la &lt;/ins&gt;funció &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;''quixot()&lt;/ins&gt;''.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;pre&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;onclick=&amp;quot;loadTXT&lt;/del&gt;(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;this.value, quijote&lt;/del&gt;)&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;quot;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/pre&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;No podem posar:&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;pre&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;onclick=&amp;quot;loadTXT(this.value, this.value)&amp;quot;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/pre&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;doncs distingeix entre una &lt;/del&gt;cadena de text &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;i un objecte tipus &lt;/del&gt;''funció''.&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==GET Request==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==GET Request==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Joan</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.joanillo.org/index.php?title=Ajax._Introducci%C3%B3&amp;diff=297209&amp;oldid=prev</id>
		<title>Joan: /* Referències */</title>
		<link rel="alternate" type="text/html" href="http://wiki.joanillo.org/index.php?title=Ajax._Introducci%C3%B3&amp;diff=297209&amp;oldid=prev"/>
		<updated>2021-01-28T17:48:47Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Referències&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ca&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Versió més antiga&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revisió del 17:48, 28 gen 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l11&quot; &gt;Línia 11:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Línia 11:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=Referències=&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=Referències=&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*http://www.w3schools.com/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;js&lt;/del&gt;/ajax_intro.asp&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*http://www.w3schools.com/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;xml&lt;/ins&gt;/ajax_intro.asp&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*https://developer.mozilla.org/en-US/docs/AJAX&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*https://developer.mozilla.org/en-US/docs/AJAX&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*https://developer.mozilla.org/en-US/docs/AJAX/Getting_Started&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*https://developer.mozilla.org/en-US/docs/AJAX/Getting_Started&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Joan</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.joanillo.org/index.php?title=Ajax._Introducci%C3%B3&amp;diff=258830&amp;oldid=prev</id>
		<title>Joan: /* POST Requests */</title>
		<link rel="alternate" type="text/html" href="http://wiki.joanillo.org/index.php?title=Ajax._Introducci%C3%B3&amp;diff=258830&amp;oldid=prev"/>
		<updated>2020-01-30T18:11:08Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;POST Requests&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Pàgina nova&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=Introducció=&lt;br /&gt;
'''AJAX = Asynchronous JavaScript and XML'''&lt;br /&gt;
&lt;br /&gt;
AJAX no és un llenguatge de programació, sinó una manera diferent d'utilitzar estàndars existents. AJAX és l'art d'intercanviar dades amb el servidor (el servidor web), i actualitzar parts d'una pàgina web sense haver de carregar de nou tota la pàgina web.&lt;br /&gt;
&lt;br /&gt;
'''Asynchronous JavaScript + XML''', no és una tecnologia en ella mateixa, sinó que és una ''nova'' apoximació per utilitzar de forma conjunta una sèrie de tecnologies que existien prèviament, com ara HTML o XHTML, Cascading Style Sheets, JavaScript, The Document Object Model, XML, XSLT, i el més important, l'objecte XMLHttpRequest.&lt;br /&gt;
&lt;br /&gt;
Quan aquestes tecnologies es combinen en el model AJAX, les pàgines web poden fer actualitzacions incrementals i ràpides en el navegador sense haver de carregar de nou la pàgina. Això fa que l'aplicació sigui més ràpida a les accions dels usuaris i més usable.&lt;br /&gt;
&lt;br /&gt;
Encara que la '''X''' de ''AJAX'' ve de ''XML'', avui en dia s'utilitza més '''JSON''' en comptes de '''XML''' degut als seus múltiples avantatges com ara tenir un pes inferior i estar integrat dins de Javascript. Tant JSON com XML s'utilitzen per empaquetar informació en el model AJAX.&lt;br /&gt;
&lt;br /&gt;
=Referències=&lt;br /&gt;
*http://www.w3schools.com/js/ajax_intro.asp&lt;br /&gt;
*https://developer.mozilla.org/en-US/docs/AJAX&lt;br /&gt;
*https://developer.mozilla.org/en-US/docs/AJAX/Getting_Started&lt;br /&gt;
*http://www.xul.fr/en-xml-ajax.html&lt;br /&gt;
===AJAX Basic===&lt;br /&gt;
*http://www.w3schools.com/xml/ajax_intro.asp&lt;br /&gt;
&lt;br /&gt;
=Aclaracions=&lt;br /&gt;
==Utiltizar funcions de ''callback'' per reunificar codi==&lt;br /&gt;
*https://www.w3schools.com/js/js_ajax_http_response.asp&lt;br /&gt;
Si volem fer vàries crides AJAX, no cal construir l'objecte XMLHttpRequest per cada crida. Podem unificar l'estructura de la crida AJAX reunificant el codi i utilitzant funcions de ''callback''.&lt;br /&gt;
&lt;br /&gt;
Una funció de ''callback'' és una funció que la passem com a paràmetre dins d'una altra funció. Anem a veure-ho amb un exemple pràctic.&lt;br /&gt;
&lt;br /&gt;
''index.html'':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
&amp;lt;meta http-equiv=&amp;quot;Content-Type&amp;quot; content=&amp;quot;text/html; charset=UTF-8&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;link href='https://fonts.googleapis.com/css?family=ABeeZee' rel='stylesheet'&amp;gt;&lt;br /&gt;
&amp;lt;link href='https://fonts.googleapis.com/css?family=Abril Fatface' rel='stylesheet'&amp;gt;&lt;br /&gt;
&amp;lt;link href='https://fonts.googleapis.com/css?family=Aclonica' rel='stylesheet'&amp;gt;&lt;br /&gt;
&amp;lt;link href='https://fonts.googleapis.com/css?family=Aladin' rel='stylesheet'&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;title&amp;gt;AJAX amb funcions de callback&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
function loadTXT(obra,cFunction) {&lt;br /&gt;
  console.log(cFunction);&lt;br /&gt;
  alert(cFunction);&lt;br /&gt;
&lt;br /&gt;
  var xhttp;&lt;br /&gt;
  xhttp=new XMLHttpRequest();&lt;br /&gt;
  xhttp.onreadystatechange = function() {&lt;br /&gt;
    if (this.readyState == 4 &amp;amp;&amp;amp; this.status == 200) {&lt;br /&gt;
      cFunction(this);&lt;br /&gt;
    }&lt;br /&gt;
  };&lt;br /&gt;
  xhttp.open(&amp;quot;GET&amp;quot;, obra+'.txt', true);&lt;br /&gt;
  xhttp.send();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function quijote(xhttp) {&lt;br /&gt;
  document.getElementById(&amp;quot;literatura&amp;quot;).style.backgroundColor = &amp;quot;#bbbbbb&amp;quot;&lt;br /&gt;
  document.getElementById(&amp;quot;literatura&amp;quot;).style.fontFamily = &amp;quot;ABeeZee&amp;quot;;&lt;br /&gt;
  document.getElementById(&amp;quot;literatura&amp;quot;).innerHTML = &amp;quot;&amp;lt;h3&amp;gt;Quijote de la Mancha&amp;lt;/h3&amp;gt;&amp;quot; + xhttp.responseText;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function tirant(xhttp) {&lt;br /&gt;
  document.getElementById(&amp;quot;literatura&amp;quot;).style.backgroundColor = &amp;quot;#cccccc&amp;quot;&lt;br /&gt;
  document.getElementById(&amp;quot;literatura&amp;quot;).style.fontFamily = &amp;quot;Abril Fatface&amp;quot;;&lt;br /&gt;
  document.getElementById(&amp;quot;literatura&amp;quot;).innerHTML = &amp;quot;&amp;lt;h3&amp;gt;Tirant lo Blanc&amp;lt;/h3&amp;gt;&amp;quot; + xhttp.responseText;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function roldan(xhttp) {&lt;br /&gt;
  document.getElementById(&amp;quot;literatura&amp;quot;).style.backgroundColor = &amp;quot;#dddddd&amp;quot;&lt;br /&gt;
  document.getElementById(&amp;quot;literatura&amp;quot;).style.fontFamily = &amp;quot;Aclonica&amp;quot;;&lt;br /&gt;
  document.getElementById(&amp;quot;literatura&amp;quot;).innerHTML = &amp;quot;&amp;lt;h3&amp;gt;Chanson de Roldan&amp;lt;/h3&amp;gt;&amp;quot; + xhttp.responseText;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function hamlet(xhttp) {&lt;br /&gt;
  document.getElementById(&amp;quot;literatura&amp;quot;).style.backgroundColor = &amp;quot;#eeeeee&amp;quot;&lt;br /&gt;
  document.getElementById(&amp;quot;literatura&amp;quot;).style.fontFamily = &amp;quot;Aladin&amp;quot;;&lt;br /&gt;
  document.getElementById(&amp;quot;literatura&amp;quot;).innerHTML = &amp;quot;&amp;lt;h3&amp;gt;Hamlet (Shakespeare)&amp;lt;/h3&amp;gt;&amp;quot; + xhttp.responseText;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;h1&amp;gt;Obres més importants de la literatura universal:&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;formulari&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;button value=&amp;quot;quijote&amp;quot; onclick=&amp;quot;loadTXT(this.value, quijote)&amp;quot;&amp;gt;Quijote&amp;lt;/button&amp;gt;&lt;br /&gt;
&amp;lt;button value=&amp;quot;tirant&amp;quot; onclick=&amp;quot;loadTXT(this.value, tirant)&amp;quot;&amp;gt;Tirant lo Blanc&amp;lt;/button&amp;gt;&lt;br /&gt;
&amp;lt;button value=&amp;quot;roldan&amp;quot; onclick=&amp;quot;loadTXT(this.value, roldan)&amp;quot;&amp;gt;Chanson de Roldan&amp;lt;/button&amp;gt;&lt;br /&gt;
&amp;lt;button value=&amp;quot;hamlet&amp;quot; onclick=&amp;quot;loadTXT(this.value, hamlet)&amp;quot;&amp;gt;Hamlet&amp;lt;/button&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;literatura&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Per fer funcionar el codi necessites 4 fitxers de text: ''quijote.txt'', ''tirant.txt'', ''roldan.txt'' i ''hamlet.txt''&lt;br /&gt;
&lt;br /&gt;
Fixem-nos en la instrucció:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
onclick=&amp;quot;loadTXT(this.value, quijote)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
No podem posar:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
onclick=&amp;quot;loadTXT(this.value, this.value)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
doncs distingeix entre una cadena de text i un objecte tipus ''funció''.&lt;br /&gt;
&lt;br /&gt;
==GET Request==&lt;br /&gt;
'''formulari_get.html''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!DOCTYPE html&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
&amp;lt;meta charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
function processar(frm) {&lt;br /&gt;
	console.log(frm.nom.value);&lt;br /&gt;
	console.log(frm.cognom.value);&lt;br /&gt;
	console.log(frm.edat.value);&lt;br /&gt;
	var xhttp = new XMLHttpRequest();&lt;br /&gt;
	xhttp.onreadystatechange = function() {&lt;br /&gt;
		if (this.readyState == 4 &amp;amp;&amp;amp; this.status == 200) {&lt;br /&gt;
			console.log(this.responseText);&lt;br /&gt;
			document.getElementById(&amp;quot;info&amp;quot;).innerHTML = this.responseText;&lt;br /&gt;
		&lt;br /&gt;
		};&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	xhttp.open(&amp;quot;GET&amp;quot;, &amp;quot;processar_formulari_get.php?nom=&amp;quot; + frm.nom.value + &amp;quot;&amp;amp;cognom=&amp;quot; + frm.cognom.value + &amp;quot;&amp;amp;edat=&amp;quot; + frm.edat.value, true);&lt;br /&gt;
	xhttp.setRequestHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/x-www-form-urlencoded&amp;quot;);&lt;br /&gt;
	xhttp.send();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Formulari bàsic&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;form name=&amp;quot;frm&amp;quot;&amp;gt;&lt;br /&gt;
	Nom: &amp;lt;input type=&amp;quot;text&amp;quot; name=&amp;quot;nom&amp;quot;&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
	Cognom: &amp;lt;input type=&amp;quot;text&amp;quot; name=&amp;quot;cognom&amp;quot;&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
	Edat: &amp;lt;input type=&amp;quot;text&amp;quot; name=&amp;quot;edat&amp;quot;&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
	&amp;lt;input onclick=&amp;quot;processar(frm)&amp;quot; type=&amp;quot;button&amp;quot; value=&amp;quot;Submit&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p id=&amp;quot;info&amp;quot;&amp;gt;info&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''processar_formulari_get.php''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$nom = $_GET[&amp;quot;nom&amp;quot;];&lt;br /&gt;
$cognom = $_GET[&amp;quot;cognom&amp;quot;];&lt;br /&gt;
$edat = $_GET[&amp;quot;edat&amp;quot;];&lt;br /&gt;
&lt;br /&gt;
/* Processar la informació:&lt;br /&gt;
inserir la informació a una base de dades, per exemple&lt;br /&gt;
Retornar al client la informació de com ha anat l'operació&lt;br /&gt;
*/&lt;br /&gt;
echo &amp;quot;GET - $nom $cognom ($edat anys): Valors inserits a la base de dades&amp;quot;;&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==POST Requests==&lt;br /&gt;
En la majoria de les ocasions hem utilitzat GET Request en comptes de POST Request.&lt;br /&gt;
&lt;br /&gt;
GET és més senzill i ràpid que POST, i es pot utilitzar en la majoria dels casos. Tanmateix, hem d'utilitzar el request POST sempre que&lt;br /&gt;
*No ens podem permetre que el servidor respongui amb un fitxer ''cached''. &lt;br /&gt;
*Quan hem d'enviar una gran quantitat d'informació al servidor (POST no té limitacions de tamany)&lt;br /&gt;
*Quan hem d'enviar dades d'usuari (per exemple a través d'un formulari), que poden contenir codificacions diverses.&lt;br /&gt;
&lt;br /&gt;
En el cas de GET, per evitar resultats de cache podem fer la tècnica que s'ha vist a classe:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
xhttp.open(&amp;quot;GET&amp;quot;, &amp;quot;demo_get.php?t=&amp;quot; + Math.random(), true);&lt;br /&gt;
xhttp.send(); &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Anem  a veure el codi mínim que envia les dades d'un formulari al servidor mitjançant una crida AJAX:&lt;br /&gt;
&lt;br /&gt;
'''formulari_post.html''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!DOCTYPE html&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
&amp;lt;meta charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
function processar(frm) {&lt;br /&gt;
	console.log(frm.nom.value);&lt;br /&gt;
	console.log(frm.cognom.value);&lt;br /&gt;
	console.log(frm.edat.value);&lt;br /&gt;
	var xhttp = new XMLHttpRequest();&lt;br /&gt;
	xhttp.onreadystatechange = function() {&lt;br /&gt;
		if (this.readyState == 4 &amp;amp;&amp;amp; this.status == 200) {&lt;br /&gt;
			console.log(this.responseText);&lt;br /&gt;
			document.getElementById(&amp;quot;info&amp;quot;).innerHTML = this.responseText;&lt;br /&gt;
		&lt;br /&gt;
		};&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	xhttp.open(&amp;quot;POST&amp;quot;, &amp;quot;processar_formulari_post.php&amp;quot;, true);&lt;br /&gt;
	xhttp.setRequestHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/x-www-form-urlencoded&amp;quot;);&lt;br /&gt;
	xhttp.send(&amp;quot;nom=&amp;quot; + frm.nom.value + &amp;quot;&amp;amp;cognom=&amp;quot; + frm.cognom.value + &amp;quot;&amp;amp;edat=&amp;quot; + frm.edat.value);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Formulari bàsic&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;form name=&amp;quot;frm&amp;quot;&amp;gt;&lt;br /&gt;
	Nom: &amp;lt;input type=&amp;quot;text&amp;quot; name=&amp;quot;nom&amp;quot;&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
	Cognom: &amp;lt;input type=&amp;quot;text&amp;quot; name=&amp;quot;cognom&amp;quot;&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
	Edat: &amp;lt;input type=&amp;quot;text&amp;quot; name=&amp;quot;edat&amp;quot;&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
	&amp;lt;input onclick=&amp;quot;processar(frm)&amp;quot; type=&amp;quot;button&amp;quot; value=&amp;quot;Submit&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p id=&amp;quot;info&amp;quot;&amp;gt;info&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''processar_formulari_post.php''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$nom = $_POST[&amp;quot;nom&amp;quot;];&lt;br /&gt;
$cognom = $_POST[&amp;quot;cognom&amp;quot;];&lt;br /&gt;
$edat = $_POST[&amp;quot;edat&amp;quot;];&lt;br /&gt;
&lt;br /&gt;
/* Processar la informació:&lt;br /&gt;
inserir la informació a una base de dades, per exemple&lt;br /&gt;
Retornar al client la informació de com ha anat l'operació&lt;br /&gt;
*/&lt;br /&gt;
echo &amp;quot;$nom $cognom ($edat anys): Valors inserits a la base de dades&amp;quot;;&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Crida AJAX amb funció que unifica GET i POST==&lt;br /&gt;
A proposta d'un alumne, anem a veure l'exemple mínim del formulari anterior amb una funció que encapsula i amaga l'objecte ''XMLHttpRequest'', dins del fitxer-llibreria ''AJAX.js'':&lt;br /&gt;
&lt;br /&gt;
script ''AJAX.js'':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
window.onResponseReady = null;&lt;br /&gt;
window.eAJAX = function(){ &lt;br /&gt;
    if(! this.hasOwnProperty('f') ) this.f = onResponseReady;&lt;br /&gt;
    if(this.readyState == 4 &amp;amp;&amp;amp; this.status == 200) this.f();&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
function AJAX(method, filename, myFunction, params) {&lt;br /&gt;
    var xhttp = new XMLHttpRequest();&lt;br /&gt;
    xhttp.onreadystatechange = myFunction;&lt;br /&gt;
    xhttp.open(method, filename, true);&lt;br /&gt;
    xhttp.setRequestHeader(&amp;quot;Content-type&amp;quot;, &amp;quot;application/x-www-form-urlencoded&amp;quot;);&lt;br /&gt;
    xhttp.send(params);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function AJAX_GET( path, params, myFunction ){&lt;br /&gt;
    if(params.length &amp;gt; 0) path =  path+&amp;quot;?&amp;quot;+formatParams(params);&lt;br /&gt;
    AJAX(&amp;quot;GET&amp;quot;, path, myFunction);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function AJAX_POST( path, params, myFunction ){&lt;br /&gt;
    var p = '';&lt;br /&gt;
    if(params.length &amp;gt; 0) p = formatParams(params);&lt;br /&gt;
    AJAX(&amp;quot;POST&amp;quot;, path, myFunction, p);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function formatParams(params){&lt;br /&gt;
    var r = &amp;quot;callback=JSONPHandler&amp;amp;&amp;quot;;&lt;br /&gt;
    for (var i = 0; i &amp;lt; params.length; i+=2) {&lt;br /&gt;
        r+= params[i]+&amp;quot;=&amp;quot;+params[i+1];&lt;br /&gt;
        if(i &amp;lt; params.length -2) r+= &amp;quot;&amp;amp;&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
    return r;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
script ''index.html'':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!DOCTYPE html&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
&amp;lt;meta charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;../AJAX.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Formulari bàsic&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;form name=&amp;quot;frm&amp;quot;&amp;gt;&lt;br /&gt;
	Nom: &amp;lt;input type=&amp;quot;text&amp;quot; name=&amp;quot;nom&amp;quot; value=&amp;quot;pol&amp;quot;&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
	Cognom: &amp;lt;input type=&amp;quot;text&amp;quot; name=&amp;quot;cognom&amp;quot; value=&amp;quot;surriel&amp;quot;&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
	Edat: &amp;lt;input type=&amp;quot;text&amp;quot; name=&amp;quot;edat&amp;quot; value=&amp;quot;19&amp;quot;&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
	&amp;lt;input onclick=&amp;quot;processar(frm)&amp;quot; type=&amp;quot;button&amp;quot; value=&amp;quot;Submit&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p id=&amp;quot;info&amp;quot;&amp;gt;info&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
    function processar(frm) {&lt;br /&gt;
        console.log(frm.nom.value);&lt;br /&gt;
        console.log(frm.cognom.value);&lt;br /&gt;
        console.log(frm.edat.value);&lt;br /&gt;
        &lt;br /&gt;
        onResponseReady = function () {&lt;br /&gt;
            console.log(this.responseText);&lt;br /&gt;
            document.getElementById(&amp;quot;info&amp;quot;).innerHTML = this.responseText;&lt;br /&gt;
        };&lt;br /&gt;
        AJAX_POST(&amp;quot;processar_formulari.php&amp;quot;, [&amp;quot;nom&amp;quot;, frm.nom.value, &amp;quot;cognom&amp;quot;, frm.cognom.value, &amp;quot;edat&amp;quot;, frm.edat.value], eAJAX);&lt;br /&gt;
        //En get:&lt;br /&gt;
        //AJAX_GET(&amp;quot;processar_formulari.php&amp;quot;, [&amp;quot;nom&amp;quot;, frm.nom.value, &amp;quot;cognom&amp;quot;, frm.cognom.value, &amp;quot;edat&amp;quot;, frm.edat.value], eAJAX);&lt;br /&gt;
    &lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
script ''processar_formulari.php'':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$nom = $_REQUEST[&amp;quot;nom&amp;quot;];&lt;br /&gt;
$cognom = $_REQUEST[&amp;quot;cognom&amp;quot;];&lt;br /&gt;
$edat = $_REQUEST[&amp;quot;edat&amp;quot;];&lt;br /&gt;
&lt;br /&gt;
/* Processar la informació:&lt;br /&gt;
inserir la informació a una base de dades, per exemple&lt;br /&gt;
Retornar al client la informació de com ha anat l'operació&lt;br /&gt;
*/&lt;br /&gt;
echo &amp;quot;$nom $cognom ($edat anys): Valors inserits a la base de dades&amp;quot;;&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
crèdits: Pol Surriel.&lt;br /&gt;
&lt;br /&gt;
L'avantatge de fer-ho d'aquesta manera és que unifica la crida AJAX ja sigui amb el mètode GET o POST, i amaga la creació de l'objecte ''XMLHttpRequest''. El desavantatge, com en l'ús de qualsevol llibreria, és que l'usuari es situa en una capa d'aplicació superior, i perd la noció del que està passant per sota. És a dir, el programador pot fer un desenvolupament de l'aplicació més ràpid, a costa de no entretenir-se en entendre el que passa per sota.&lt;br /&gt;
&lt;br /&gt;
{{Autor}}, abril 2019&lt;br /&gt;
[[Categoria: Institut Jaume Balmes]]&lt;br /&gt;
[[Categoria: Assignatura DAW-M06-WEC]]&lt;/div&gt;</summary>
		<author><name>Joan</name></author>
		
	</entry>
</feed>