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

<channel>
	<title>rails y más cosas &#187; Ajax</title>
	<atom:link href="http://www.railsymas.com/category/ajax/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.railsymas.com</link>
	<description>Nuevas Tecnologías</description>
	<lastBuildDate>Sat, 28 Jan 2012 10:23:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Desarrollo web ejemplo jquery botones</title>
		<link>http://www.railsymas.com/2010/04/29/desarrollo-web-ejemplo-jquery-botones/</link>
		<comments>http://www.railsymas.com/2010/04/29/desarrollo-web-ejemplo-jquery-botones/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 00:48:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ajax]]></category>

		<guid isPermaLink="false">http://www.railsymas.com/?p=1476</guid>
		<description><![CDATA[Jquery nos permite trabajar de una forma rápida y sencilla con el dom del árbol de elementos 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 [...]]]></description>
			<content:encoded><![CDATA[<p> Jquery nos permite trabajar de una forma rápida y sencilla con el dom del árbol de elementos</p>
<p><span id="more-1476"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;">&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;html</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;head<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span>  <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;jquery.js&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>	
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;style</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/css&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
   #contenedor {
     width:600px;
     margin-left:auto;
     margin-right:auto;
   }
   #contenido {
   width:370px;    
   float:left;
   height:400px;
   }
&nbsp;
   .segundo
   {
     font-size:14px;
     background-color:#ff8844;
   }
   .tercero
   {
     font-size:16px;
     background-color:#88ff77;
   }
   .contenidonuevo{
    color:#fff;    
   }
&nbsp;
   #capaboton {
     float:left;
     width:160px;         
     padding:20px;    
    }
&nbsp;
    .boton { width:100px;
    background-color:#ccc;
    border: #ddd 3px solid;
    padding:10px;     
    text-align:center;
    margin-bottom:5px;
    }  
&nbsp;
    .seleccionado {
    border-style:double;
    border-color:#000;
   }    
   .ocultar {
    display:none;
   }
&nbsp;
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/style<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/javascript&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
     $(document).ready( function()
     { 
	$(&quot;#primero&quot;).bind(&quot;click&quot;, function () {
&nbsp;
	  $(&quot;#contenido&quot;).removeClass(&quot;segundo&quot;).removeClass(&quot;tercero&quot;);	
	  $(&quot;#capaboton .boton&quot;).removeClass(&quot;seleccionado&quot;);
	  $(this).addClass(&quot;seleccionado&quot;);
&nbsp;
&nbsp;
	});
&nbsp;
	$(&quot;#segundo&quot;).bind(&quot;click&quot;, function () {
&nbsp;
	  $(&quot;#contenido&quot;).addClass(&quot;segundo&quot;).removeClass(&quot;tercero&quot;);
	  $(&quot;#capaboton .boton&quot;).removeClass(&quot;seleccionado&quot;);
	  $(this).addClass(&quot;seleccionado&quot;);
	});
&nbsp;
	$(&quot;#tercero&quot;).bind(&quot;click&quot;, function () {
&nbsp;
	  $(&quot;#contenido&quot;).addClass(&quot;tercero&quot;).removeClass(&quot;segundo&quot;);
	  $(&quot;#capaboton .boton&quot;).removeClass(&quot;seleccionado&quot;);
	  $(this).addClass(&quot;seleccionado&quot;);
&nbsp;
	 });
	$(&quot;#contenido h2&quot;).toggle(	
	function() { $(&quot;#capaboton .boton&quot;).addClass(&quot;ocultar&quot;); }
	, 
        function() { $(&quot;#capaboton .boton&quot;).removeClass(&quot;ocultar&quot;); }        
	);
     }
     );
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/head<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;body<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;contenedor&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;contenido&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h2<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> Jquery <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h2<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
       texto dentro de una capa de contenido
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>       
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;capaboton&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;boton&quot;</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;primero&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
     cambiar
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;boton&quot;</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;segundo&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
     cambiar dos
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;boton&quot;</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;tercero&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
     cambiar tres
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/body<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/html<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>imagen inicial </p>
<p><a href="http://www.railsymas.com/wp-content/uploads/2010/04/primercaso.png"><img src="http://www.railsymas.com/wp-content/uploads/2010/04/primercaso.png" alt="" title="primercaso" width="553" height="240" class="alignnone size-full wp-image-1483" /></a></p>
<p>seleccionamos el segundo botón</p>
<p><a href="http://www.railsymas.com/wp-content/uploads/2010/04/segundocaso.png"><img src="http://www.railsymas.com/wp-content/uploads/2010/04/segundocaso.png" alt="" title="segundocaso" width="537" height="435" class="alignnone size-full wp-image-1485" /></a></p>
<p>seleccionamos el tercer botón</p>
<p><a href="http://www.railsymas.com/wp-content/uploads/2010/04/situacion3.png"><img src="http://www.railsymas.com/wp-content/uploads/2010/04/situacion3.png" alt="" title="situacion3" width="572" height="440" class="alignnone size-full wp-image-1487" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.railsymas.com/2010/04/29/desarrollo-web-ejemplo-jquery-botones/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Calendario realizado con prototype</title>
		<link>http://www.railsymas.com/2009/11/30/calendario-realizado-con-prototype/</link>
		<comments>http://www.railsymas.com/2009/11/30/calendario-realizado-con-prototype/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 19:09:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ajax]]></category>

		<guid isPermaLink="false">http://www.railsymas.com/?p=956</guid>
		<description><![CDATA[months Número de meses que mostramos (default: 2). format Formato para las fechas en los elementos input (default: %b %d, %Y) weekOffset Fecha de inicio de la semana (usa 1 para empezar la semana en Lunes). startField, endField Declara un rango de inicio y fin. (por defecto lo genera automáticamente) previousButton, todayButton, nextButton, resetButton Declara [...]]]></description>
			<content:encoded><![CDATA[<p>months<br />
    Número de meses que mostramos (default: 2).<br />
format<br />
    Formato para las fechas en los elementos input (default: %b %d, %Y)<br />
weekOffset<br />
    Fecha de inicio de la semana (usa 1 para empezar la semana en Lunes).<br />
startField, endField<br />
    Declara un rango de inicio y fin. (por defecto lo genera automáticamente)<br />
previousButton, todayButton, nextButton, resetButton</p>
<p> <span id="more-956"></span><br />
    Declara los botones de navegación (por defecto lo genera automáticamente)<br />
earliest, latest<br />
    Permite espeficiar los rangos de fechas anteriores o posteriores que no podrán ser seleccionadas<br />
maxRange<br />
    Limita el máximo de días a la vez </p>
<p>Enlace a la web   <a href="http://stephencelis.github.com/timeframe/#example_information">Time frame </a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.railsymas.com/2009/11/30/calendario-realizado-con-prototype/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>filosofía menos es más</title>
		<link>http://www.railsymas.com/2009/08/10/filosofia-menos-es-mas/</link>
		<comments>http://www.railsymas.com/2009/08/10/filosofia-menos-es-mas/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 09:12:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ajax]]></category>

		<guid isPermaLink="false">http://www.railsymas.com/?p=406</guid>
		<description><![CDATA[Es el lema que reza en el proyecto jquery, como con menos líneas de código podemos hacer más cosas. Una de las ventajas de jquery es la facilidad para poder acceder a diferentes elementos del árbol del dom sin tener que escribir pesadas líneas de código (bucles), para llegar al elemento y poder aplicar un [...]]]></description>
			<content:encoded><![CDATA[<p>Es el lema que reza en el proyecto jquery,  como con menos líneas de código podemos hacer más cosas. Una de las ventajas de jquery es la facilidad para poder acceder a diferentes elementos del árbol del dom sin tener que escribir pesadas líneas de código (bucles), para llegar al elemento y poder aplicar un efecto.<br />
<span id="more-406"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">&lt;script  type=&quot;text/javascript&quot;   src=&quot;jquery.js&quot;&gt;&lt;/script&gt;
&lt;style type=&quot;text/css&quot;&gt;
   .par { color:#995511;   }
   .impar { color:#6666ff; }
   .unica { color:#779999; }
&lt;/style&gt;
   <span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
   $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span> <span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;tr:odd&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;impar&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;tr:even&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;par&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'td:contains(&quot;tercera&quot;)'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">parent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;td:eq(2)&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;unica&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>	   
   <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span>
&lt;/head&gt;
&lt;body&gt;
&lt;table&gt;
&nbsp;
   &lt;tr&gt;
     &lt;td&gt; elemento uno &lt;/td&gt;
     &lt;td&gt; elemento dos &lt;/td&gt;
     &lt;td&gt; elemento tres &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
    &lt;td&gt;  elemento dos uno&lt;/td&gt;
    &lt;td&gt;  elemento dos dos &lt;/td&gt;
    &lt;td&gt;  elemento dos tres &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
    &lt;td&gt;  tercera fila &lt;/td&gt;
    &lt;td&gt;  elemento tres dos &lt;/td&gt;
    &lt;td&gt;  elemento tres tres &lt;/td&gt;
   &lt;/tr&gt;
&nbsp;
&lt;/table&gt;</pre></td></tr></table></div>

<p>cuando la función ready indica que el ábol del dom esta preparado acceder las filas de la tabla  es algo rápido y sencillo.<br />
Con $(&#8220;tr:odd&#8221;).addClass(&#8220;impar&#8221;) estamos añadiendo la clase css impar a las filas impares de la tabla, para las pares hacemos $(&#8220;tr:even&#8221;).addClass(&#8220;par&#8221;); </p>
<p>Tal es la versatilidad de jquery que nos permite acceder al padre &#8220;parent&#8221; &#8220;sibiling&#8221; hermano de un elemento del dom.</p>
<p>Para modificar el segundo elmento de la fila de la tabla que contiene la palabra &#8220;tercera&#8221; hacemos, $(&#8216;td:contains(&#8220;tercera&#8221;)&#8217;).parent().find(&#8220;td:eq(2)&#8221;).addClass(&#8220;unica&#8221;); y le aplicamos la clase única.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.railsymas.com/2009/08/10/filosofia-menos-es-mas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jquery framework para javascript</title>
		<link>http://www.railsymas.com/2009/08/09/jquery-framework-para-javascript/</link>
		<comments>http://www.railsymas.com/2009/08/09/jquery-framework-para-javascript/#comments</comments>
		<pubDate>Sun, 09 Aug 2009 11:04:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ajax]]></category>

		<guid isPermaLink="false">http://www.railsymas.com/?p=398</guid>
		<description><![CDATA[Para instalar jquery, nos descargamos la la página web oficial www.jquery.com el archivo jquery.js. Para utilizarlo en los html ponemos . Es necesario insertar primero jquery.js si lo van a utilizar otros ficheros js creados por nosotros. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.railsymas.com/wp-content/uploads/2009/08/jqurery.png" alt="jqurery" title="jqurery" width="500" height="400" class="alignnone size-full wp-image-400" /></p>
<p>Para instalar jquery, nos descargamos la la página web oficial www.jquery.com  el archivo jquery.js.</p>
<p>Para utilizarlo en los html ponemos <script type="text/javascript" src="jquery.js"></script>. Es necesario insertar primero jquery.js si lo van a utilizar otros ficheros js creados por nosotros.<br />
<span id="more-398"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">&lt;head&gt;
&lt;style type=&quot;text/css&quot;&gt;
	 .boton {   color:#00ff00;
			font-size:14px;
			text-decoration:none;
	            }
	&lt;/style&gt;
        &lt;script type=&quot;text/javascript&quot; src=&quot;jquery.js&quot;&gt;&lt;/script&gt; 
	<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
	$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span> 
	<span style="color: #003366; font-weight: bold;">function</span> mensaje <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
	    <span style="color: #000066;">alert</span> <span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;hola mundo <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;boton&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
	<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span>
 &lt;/head&gt;
 &lt;body&gt;
   &lt;a href=&quot;www.railsymas.com&quot;&gt;enlace&lt;/a&gt;
&nbsp;
 &lt;/body&gt;</pre></td></tr></table></div>

<p>Tenemos un estilo css incorporado a la página html y mediante jquery vamos a cambiar el color del enlace del body de azul predeterminado a verde además de cambiar el tamaño del texto del enlace.</p>
<p>Mediante  $(document).ready,  jquery determina que el árbol del dom está listo para ser tratado. Se carga la función mensaje que muestra una pequeña ventana de javascript con el mensaje hola mundo y $(&#8220;a&#8221;).addClass(&#8220;boton&#8221;); añade al enlace la clase boton de css.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.railsymas.com/2009/08/09/jquery-framework-para-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ajax y php 3 parte</title>
		<link>http://www.railsymas.com/2009/07/14/ajax-y-php-3-parte/</link>
		<comments>http://www.railsymas.com/2009/07/14/ajax-y-php-3-parte/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 09:52:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.railsymas.com/?p=235</guid>
		<description><![CDATA[Para terminar tenemos el código del fichero php respuesta.php 1 2 3 4 5 6 7 8 9 10 11 12 &#60;? &#160; if &#40;isset&#40;$_POST&#41;&#41; &#123; $nombre=$_POST&#91;&#34;deporte&#34;&#93;; $apellidos=$_POST&#91;&#34;color&#34;&#93;; $correo=$_POST&#91;&#34;correo&#34;&#93;; &#160; echo &#34;{deporte:'$deporte', color:'$color', correo:'$correo'}&#34;; &#160; &#125; ?&#62;]]></description>
			<content:encoded><![CDATA[<p>Para terminar tenemos el código del fichero php respuesta.php</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>   
	    <span style="color: #000088;">$nombre</span><span style="color: #339933;">=</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;deporte&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	    <span style="color: #000088;">$apellidos</span><span style="color: #339933;">=</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;color&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	   <span style="color: #000088;">$correo</span><span style="color: #339933;">=</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;correo&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;{deporte:'<span style="color: #006699; font-weight: bold;">$deporte</span>', color:'<span style="color: #006699; font-weight: bold;">$color</span>', correo:'<span style="color: #006699; font-weight: bold;">$correo</span>'}&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.railsymas.com/2009/07/14/ajax-y-php-3-parte/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ajax y php  2 parte</title>
		<link>http://www.railsymas.com/2009/07/13/ajax-y-php-2-parte/</link>
		<comments>http://www.railsymas.com/2009/07/13/ajax-y-php-2-parte/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 22:10:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.railsymas.com/?p=169</guid>
		<description><![CDATA[Código del fichero javascript validacion.js 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 [...]]]></description>
			<content:encoded><![CDATA[<p>Código del fichero javascript  validacion.js</p>
<p><span id="more-169"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// JavaScript Document</span>
&nbsp;
window.<span style="color: #000066;">onload</span><span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  document.<span style="color: #660066;">forms</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">onsubmit</span><span style="color: #339933;">=</span>recogerFormulario<span style="color: #339933;">;</span>
  <span style="color: #003366; font-weight: bold;">var</span> selector<span style="color: #339933;">=</span>document.<span style="color: #660066;">forms</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  selector.<span style="color: #660066;">estilo</span>.<span style="color: #660066;">onchange</span><span style="color: #339933;">=</span>establecerEstilo<span style="color: #339933;">;</span>	 
&nbsp;
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// Definimos un constructor para los datos del formulario para quedar almacenados y trabajar con ellos</span>
<span style="color: #003366; font-weight: bold;">function</span> formulario <span style="color: #009900;">&#40;</span>deporte<span style="color: #339933;">,</span>color<span style="color: #339933;">,</span>correo<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
   <span style="color: #006600; font-style: italic;">//propiedad deporte de la clase</span>
   <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">deporte</span><span style="color: #339933;">=</span>deporte<span style="color: #339933;">;</span>
   <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">color</span><span style="color: #339933;">=</span>color<span style="color: #339933;">;</span>
   <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">correo</span><span style="color: #339933;">=</span>correo<span style="color: #339933;">;</span>
   <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">valido</span><span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
   <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">mensaje</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #339933;">;</span>
   <span style="color: #006600; font-style: italic;">//asignar la propiedad de un objeto a una funcion externa </span>
   <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">validar</span><span style="color: #339933;">=</span>validar<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> recogerFormulario<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span> 
  <span style="color: #006600; font-style: italic;">//le pasamos los datos a las correspondientes funcion de comprobacion pasandole el nombre etc gracias al this del formulario </span>
&nbsp;
   chequeoCampos<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">deporte</span>.<span style="color: #660066;">value</span><span style="color: #339933;">,</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">color</span>.<span style="color: #660066;">value</span><span style="color: #339933;">,</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">correo</span>.<span style="color: #660066;">value</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #006600; font-style: italic;">// return false;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> validar<span style="color: #009900;">&#40;</span>registro<span style="color: #009900;">&#41;</span> 
<span style="color: #009900;">&#123;</span> 
&nbsp;
&nbsp;
	 <span style="color: #006600; font-style: italic;">//primero comprobamos que los campos del formulario no estan vacios </span>
	 <span style="color: #006600; font-style: italic;">//variable local que indica si todos los campos estan completos</span>
	 <span style="color: #003366; font-weight: bold;">var</span> completo<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	 <span style="color: #003366; font-weight: bold;">var</span> direccion<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
	 <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">deporte</span><span style="color: #339933;">==</span><span style="color: #003366; font-weight: bold;">null</span> <span style="color: #339933;">||</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">deporte</span>.<span style="color: #660066;">length</span><span style="color: #339933;">==</span><span style="color: #CC0000;">0</span> <span style="color: #009900;">&#41;</span>
	    <span style="color: #009900;">&#123;</span>  completo<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
&nbsp;
	 <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">color</span><span style="color: #339933;">==</span><span style="color: #003366; font-weight: bold;">null</span> <span style="color: #339933;">||</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">color</span>.<span style="color: #660066;">length</span><span style="color: #339933;">==</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span>
	 	<span style="color: #009900;">&#123;</span>   completo<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
&nbsp;
	 <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">correo</span><span style="color: #339933;">==</span><span style="color: #003366; font-weight: bold;">null</span> <span style="color: #339933;">||</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">correo</span>.<span style="color: #660066;">length</span><span style="color: #339933;">==</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span>
	 	<span style="color: #009900;">&#123;</span> completo<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
&nbsp;
     <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">correo</span>.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span> <span style="color: #339933;">||</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">correo</span>.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;@&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==-</span><span style="color: #CC0000;">1</span> <span style="color: #339933;">||</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">correo</span>.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot; &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">!=-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span>
	 <span style="color: #009900;">&#123;</span>
		direccion<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span> 
	 <span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>completo<span style="color: #339933;">==</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span>direccion<span style="color: #339933;">==</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">valido</span><span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
	descodificarMensaje<span style="color: #009900;">&#40;</span>completo<span style="color: #339933;">,</span>direccion<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	 
&nbsp;
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> descodificarMensaje<span style="color: #009900;">&#40;</span>completo<span style="color: #339933;">,</span>direccion<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> texto<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>completo<span style="color: #339933;">==</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>  texto<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;hay campos sin completar&quot;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
  <span style="color: #000066; font-weight: bold;">else</span>
  <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>direccion<span style="color: #339933;">==</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>  texto<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;la direccion de correo no es correcta&quot;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  mensaje<span style="color: #009900;">&#40;</span>texto<span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;red&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> 
&nbsp;
&nbsp;
<span style="color: #006600; font-style: italic;">//funcion encargada de mostrar el mensaje por pantalla en un determinado color</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> limpiar<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> formulario<span style="color: #339933;">=</span>document.<span style="color: #660066;">forms</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
  formulario.<span style="color: #660066;">deporte</span>.<span style="color: #660066;">value</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #339933;">;</span>
  formulario.<span style="color: #660066;">color</span>.<span style="color: #660066;">value</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #339933;">;</span>
  formulario.<span style="color: #660066;">correo</span>.<span style="color: #660066;">value</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> mensaje<span style="color: #009900;">&#40;</span>texto<span style="color: #339933;">,</span>colores<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span> 
   <span style="color: #006600; font-style: italic;">//accedemos a la capa mensaje para escribir el codigo correspondiente</span>
   <span style="color: #003366; font-weight: bold;">var</span> msj<span style="color: #339933;">=</span>document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;mensaje&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
   <span style="color: #006600; font-style: italic;">//si no hay mensaje de error todo esta bien limpiamos los campos y si tenemos un mensaje anterior lo limpiamos</span>
   <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>texto<span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>
   <span style="color: #009900;">&#123;</span> limpiar<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>msj.<span style="color: #660066;">hasChildNodes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #006600; font-style: italic;">//si tienes nodos hijos</span>
       <span style="color: #009900;">&#123;</span>
	     msj.<span style="color: #660066;">removeChild</span><span style="color: #009900;">&#40;</span>msj.<span style="color: #660066;">firstChild</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
       <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #006600; font-style: italic;">//en caso contrario cogemos y escribimos el mensaje correspondiente y en el color correpondiente</span>
   <span style="color: #000066; font-weight: bold;">else</span>
   <span style="color: #009900;">&#123;</span>  
&nbsp;
&nbsp;
   <span style="color: #006600; font-style: italic;">//determinamos las propiedades de estilo</span>
   msj.<span style="color: #660066;">style</span>.<span style="color: #660066;">color</span><span style="color: #339933;">=</span>colores<span style="color: #339933;">;</span>
   msj.<span style="color: #660066;">style</span>.<span style="color: #660066;">fontSize</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;0.9em&quot;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #006600; font-style: italic;">//eliminamos los mensajes antiguos que tuviese esa capa anteriormente</span>
   <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>msj.<span style="color: #660066;">hasChildNodes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #006600; font-style: italic;">//si tienes nodos hijos</span>
   <span style="color: #009900;">&#123;</span>
	  msj.<span style="color: #660066;">removeChild</span><span style="color: #009900;">&#40;</span>msj.<span style="color: #660066;">firstChild</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #006600; font-style: italic;">//creamos el nuevo</span>
   msj.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">createTextNode</span><span style="color: #009900;">&#40;</span>texto<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> crearCadenaConsulta <span style="color: #009900;">&#40;</span>deporte<span style="color: #339933;">,</span>color<span style="color: #339933;">,</span>correo<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
&nbsp;
 <span style="color: #003366; font-weight: bold;">var</span> cadenaConsulta<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
 cadenaConsulta<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;deporte=&quot;</span><span style="color: #339933;">+</span>deporte<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;&amp;&quot;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;color=&quot;</span><span style="color: #339933;">+</span>color<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;&amp;&quot;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;correo=&quot;</span><span style="color: #339933;">+</span>correo<span style="color: #339933;">;</span>
&nbsp;
&nbsp;
 <span style="color: #000066; font-weight: bold;">return</span> cadenaConsulta<span style="color: #339933;">;</span>  
&nbsp;
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
&nbsp;
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> chequeoCampos<span style="color: #009900;">&#40;</span>valordeporte<span style="color: #339933;">,</span>valorcolor<span style="color: #339933;">,</span>valorCorreo<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>   
&nbsp;
	<span style="color: #006600; font-style: italic;">//creamos un objeto de la clase formulario</span>
	<span style="color: #003366; font-weight: bold;">var</span> cadenaConsulta<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> registro<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">new</span> formulario<span style="color: #009900;">&#40;</span>valordeporte<span style="color: #339933;">,</span>valorcolor<span style="color: #339933;">,</span>valorCorreo<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">//direccion de la url a donde va la peticion</span>
	<span style="color: #003366; font-weight: bold;">var</span> url<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">//validate se convierte en la propiedad de </span>
	registro.<span style="color: #660066;">validar</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
	<span style="color: #006600; font-style: italic;">//si el registro es valido pasamos a crear la cadena de consulta </span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>registro.<span style="color: #660066;">valido</span><span style="color: #339933;">==</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
	  cadenaConsulta<span style="color: #339933;">=</span>crearCadenaConsulta<span style="color: #009900;">&#40;</span>registro.<span style="color: #660066;">deporte</span><span style="color: #339933;">,</span>registro.<span style="color: #660066;">color</span><span style="color: #339933;">,</span>registro.<span style="color: #660066;">correo</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	  peticion<span style="color: #009900;">&#40;</span>cadenaConsulta<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> peticion <span style="color: #009900;">&#40;</span>cadenaConsulta<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>  
   <span style="color: #006600; font-style: italic;">//la direccion url donde ubicammos el fichero php</span>
   <span style="color: #003366; font-weight: bold;">var</span> url<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;respuesta.php&quot;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">XMLHttpRequest</span><span style="color: #009900;">&#41;</span>
   <span style="color: #009900;">&#123;</span>
&nbsp;
	 http_request<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">new</span> XMLHttpRequest<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #000066; font-weight: bold;">else</span>
   <span style="color: #009900;">&#123;</span>
	  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">ActiveXObject</span><span style="color: #009900;">&#41;</span>
	  <span style="color: #009900;">&#123;</span>
&nbsp;
		  http_request<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">new</span> ActiveXObject<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Microsoft.XMLHTTP&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>http_request<span style="color: #009900;">&#41;</span>
		  <span style="color: #009900;">&#123;</span>
			  http_request<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">new</span> ActiveXObject<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Msxml2.XMLHTTP&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		  <span style="color: #009900;">&#125;</span>
	   <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
	<span style="color: #000066; font-weight: bold;">try</span>
	<span style="color: #009900;">&#123;</span>
	http_request.<span style="color: #660066;">onreadystatechange</span><span style="color: #339933;">=</span>muestraContenido<span style="color: #339933;">;</span>
	http_request.<span style="color: #000066;">open</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;POST&quot;</span><span style="color: #339933;">,</span>url<span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">//configuracion de la cabecera de una aplicacion post content type</span>
	http_request.<span style="color: #660066;">setRequestHeader</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Content-Type&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;application/x-www-form-urlencoded; charset=UTF-8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	http_request.<span style="color: #660066;">send</span><span style="color: #009900;">&#40;</span>cadenaConsulta<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>err<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;espera unos segundo y vuelve a intentar conectar el servidor&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> 
&nbsp;
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> muestraContenido <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>    
&nbsp;
	 <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>http_request.<span style="color: #660066;">readyState</span><span style="color: #339933;">==</span> <span style="color: #CC0000;">4</span> <span style="color: #009900;">&#41;</span>
	 <span style="color: #009900;">&#123;</span>  
	     <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;peticion completa&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		 <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>http_request.<span style="color: #000066;">status</span><span style="color: #339933;">==</span><span style="color: #CC0000;">200</span><span style="color: #009900;">&#41;</span>
		 <span style="color: #009900;">&#123;</span>   
			<span style="color: #003366; font-weight: bold;">var</span> respuesta<span style="color: #339933;">=</span>http_request.<span style="color: #660066;">responseText</span><span style="color: #339933;">;</span>
		    <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>respuesta<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #003366; font-weight: bold;">var</span> obj<span style="color: #339933;">=</span><span style="color: #000066; font-weight: bold;">eval</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;(&quot;</span><span style="color: #339933;">+</span>respuesta<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;)&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			devolverDatos<span style="color: #009900;">&#40;</span>obj<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		 <span style="color: #009900;">&#125;</span>
&nbsp;
	 	 <span style="color: #000066; font-weight: bold;">else</span>
	 	 <span style="color: #009900;">&#123;</span>
          <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;problema con la comunicacion con el servidor&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	 	 <span style="color: #009900;">&#125;</span>
	 <span style="color: #009900;">&#125;</span> 
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> devolverDatos <span style="color: #009900;">&#40;</span>obj<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #006600; font-style: italic;">//mandamos los datos del servidor a la pagina del formulario a la capa de datos</span>
	<span style="color: #003366; font-weight: bold;">var</span> capaDatos<span style="color: #339933;">=</span>document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;datos&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">//creamos la cadena a mostrar</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">var</span> info<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;&lt;h4&gt; Los datos del proceso de inscripción son:&lt;h4&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	info<span style="color: #339933;">+=</span><span style="color: #3366CC;">&quot;&lt;br/&gt;deporte: &quot;</span><span style="color: #339933;">+</span>obj<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;deporte&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;&lt;br/&gt;color: &quot;</span><span style="color: #339933;">+</span>obj<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;color&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;&lt;br/&gt;correo: &quot;</span><span style="color: #339933;">+</span>obj<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;correo&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;&lt;br/&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">//limpiamos si hay texto dinamico html</span>
&nbsp;
	capaDatos.<span style="color: #660066;">innerHTML</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">//damos formato</span>
&nbsp;
	capaDatos.<span style="color: #660066;">style</span>.<span style="color: #660066;">backgroundColor</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;#99CC00&quot;</span><span style="color: #339933;">;</span>
	capaDatos.<span style="color: #660066;">style</span>.<span style="color: #660066;">color</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;#FFFFFF&quot;</span><span style="color: #339933;">;</span>
	capaDatos.<span style="color: #660066;">style</span>.<span style="color: #660066;">width</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;80%&quot;</span><span style="color: #339933;">;</span>
	capaDatos.<span style="color: #660066;">style</span>.<span style="color: #660066;">border</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;thin solid black&quot;</span><span style="color: #339933;">;</span>
	capaDatos.<span style="color: #660066;">style</span>.<span style="color: #660066;">padding</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;0.5em&quot;</span><span style="color: #339933;">;</span>	
	capaDatos.<span style="color: #660066;">innerHTML</span><span style="color: #339933;">=</span>info<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> establecerEstilo <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
   <span style="color: #003366; font-weight: bold;">var</span> estilo<span style="color: #339933;">=</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</span><span style="color: #339933;">;</span>
   <span style="color: #003366; font-weight: bold;">var</span> capaDatos<span style="color: #339933;">=</span>document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;datos&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
&nbsp;
   <span style="color: #000066; font-weight: bold;">switch</span> <span style="color: #009900;">&#40;</span>estilo<span style="color: #009900;">&#41;</span> 
   <span style="color: #009900;">&#123;</span>
	  <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'verde'</span><span style="color: #339933;">:</span>
	  capaDatos.<span style="color: #660066;">style</span>.<span style="color: #660066;">backgroundColor</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;#99CC00&quot;</span><span style="color: #339933;">;</span>
	  capaDatos.<span style="color: #660066;">style</span>.<span style="color: #660066;">color</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;#FFFFFF&quot;</span><span style="color: #339933;">;</span>
	  capaDatos.<span style="color: #660066;">style</span>.<span style="color: #660066;">width</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;80%&quot;</span><span style="color: #339933;">;</span>
	  capaDatos.<span style="color: #660066;">style</span>.<span style="color: #660066;">border</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;thin solid black&quot;</span><span style="color: #339933;">;</span>
	  capaDatos.<span style="color: #660066;">style</span>.<span style="color: #660066;">padding</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;0.5em&quot;</span><span style="color: #339933;">;</span>
	  <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
	  <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'azul'</span><span style="color: #339933;">:</span>
	  capaDatos.<span style="color: #660066;">style</span>.<span style="color: #660066;">backgroundColor</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;#0099FF&quot;</span><span style="color: #339933;">;</span>
	  capaDatos.<span style="color: #660066;">style</span>.<span style="color: #660066;">color</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;#FFFFFF&quot;</span><span style="color: #339933;">;</span>
	  capaDatos.<span style="color: #660066;">style</span>.<span style="color: #660066;">width</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;80%&quot;</span><span style="color: #339933;">;</span>
	  capaDatos.<span style="color: #660066;">style</span>.<span style="color: #660066;">border</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;thin solid red&quot;</span><span style="color: #339933;">;</span>
	  capaDatos.<span style="color: #660066;">style</span>.<span style="color: #660066;">padding</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;0.5em&quot;</span><span style="color: #339933;">;</span>
	  <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
&nbsp;
	  <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'rosa'</span><span style="color: #339933;">:</span>
	  capaDatos.<span style="color: #660066;">style</span>.<span style="color: #660066;">backgroundColor</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;#FF33FF&quot;</span><span style="color: #339933;">;</span>
	  capaDatos.<span style="color: #660066;">style</span>.<span style="color: #660066;">color</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;#FFFFFF&quot;</span><span style="color: #339933;">;</span>
	  capaDatos.<span style="color: #660066;">style</span>.<span style="color: #660066;">width</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;80%&quot;</span><span style="color: #339933;">;</span>
	  capaDatos.<span style="color: #660066;">style</span>.<span style="color: #660066;">border</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;thin solid green&quot;</span><span style="color: #339933;">;</span>
	  capaDatos.<span style="color: #660066;">style</span>.<span style="color: #660066;">padding</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;0.5em&quot;</span><span style="color: #339933;">;</span>
	  <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
&nbsp;
	  <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'cosmopolita'</span><span style="color: #339933;">:</span>
	  capaDatos.<span style="color: #660066;">style</span>.<span style="color: #660066;">backgroundColor</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;#6633CC&quot;</span><span style="color: #339933;">;</span>
	  capaDatos.<span style="color: #660066;">style</span>.<span style="color: #660066;">color</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;#FFFFFF&quot;</span><span style="color: #339933;">;</span>
	  capaDatos.<span style="color: #660066;">style</span>.<span style="color: #660066;">maxWidth</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;80%&quot;</span><span style="color: #339933;">;</span>
	  capaDatos.<span style="color: #660066;">style</span>.<span style="color: #660066;">border</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;thin solid yellow&quot;</span><span style="color: #339933;">;</span>
	  capaDatos.<span style="color: #660066;">style</span>.<span style="color: #660066;">padding</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;0.5em&quot;</span><span style="color: #339933;">;</span>
	  <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Enlace &#8220;link&#8221; a  siguiente post  <a href="http://www.railsymas.com/2009/07/14/ajax-y-php-3-parte/">Enlace Ajax  3 parte</a>  FINAL DEL EJEMPLO &#8220;finish&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.railsymas.com/2009/07/13/ajax-y-php-2-parte/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ajax y php 1 parte</title>
		<link>http://www.railsymas.com/2009/07/13/ajax-y-php-1-parte/</link>
		<comments>http://www.railsymas.com/2009/07/13/ajax-y-php-1-parte/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 20:11:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ajax]]></category>

		<guid isPermaLink="false">http://www.railsymas.com/?p=210</guid>
		<description><![CDATA[Creación del formulario html que nos va a servir para la recogida de datos que se le van a pasar al fichero php Código del fichero html formulario html 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 &#60;script type=&#34;text/javascript&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>Creación del formulario html que nos va a servir para la recogida de datos que se le van a pasar al fichero php</p>
<p>Código del fichero html formulario html</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;validacion.js&quot;</span>&gt;</span> <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>formulario<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;javascript:void%200&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;mensaje&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Deporte favorito: <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;deporte&quot;</span> <span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;20&quot;</span> <span style="color: #000066;">maxlength</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;20&quot;</span><span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Color favorito: <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;color&quot;</span> <span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;20&quot;</span> <span style="color: #000066;">maxlength</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;20&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Dirección de Correo: <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;correo&quot;</span> <span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;20&quot;</span> <span style="color: #000066;">maxlength</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;40&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span><span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;enviar&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;enviar&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span><span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span><span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">select</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;estilo&quot;</span>&gt;</span> 
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">option</span> <span style="color: #000066;">label</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;verde&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;verde&quot;</span> selected&gt;</span>Verde<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">option</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">option</span> <span style="color: #000066;">label</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;rosa&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;rosa&quot;</span>&gt;</span>Rosa<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">option</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">option</span> <span style="color: #000066;">label</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;azul&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;azul&quot;</span>&gt;</span>Azul<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">option</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">option</span> <span style="color: #000066;">label</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;cosmopolita&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;cosmopolita&quot;</span>&gt;</span>Cosmopolita<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">option</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">select</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span><span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span><span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;datos&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span></pre></td></tr></table></div>

<p>Como se puede observar se trata de un formulario simple en el que se piden una serie de datos al usuario y se comprueba si estan en blanco los datos y si es una direccion de correo (&#8220;no se utilizan expresiones regulares&#8221;)<br />
<img src="http://www.railsymas.com/wp-content/uploads/2009/07/formularioajax.png" alt="formularioajax" title="formularioajax" width="523" height="503" class="alignnone size-full wp-image-219" /><br />
<span id="more-210"></span><br />
Una vez rellenados los campos correctamente el código javascript nos muestra las siguientes pantallas<br />
<img src="http://www.railsymas.com/wp-content/uploads/2009/07/peticioncompleta1.png" alt="peticioncompleta" title="peticioncompleta" width="398" height="115" class="alignnone size-full wp-image-226" /><br />
Los datos enviados al servidor<br />
<img src="http://www.railsymas.com/wp-content/uploads/2009/07/datos.png" alt="datos" title="datos" width="499" height="119" class="alignnone size-full wp-image-228" /><br />
resultado de la devolución de los datos desde el servidor<br />
<img src="http://www.railsymas.com/wp-content/uploads/2009/07/resultado1.png" alt="resultado" title="resultado" width="534" height="544" class="alignnone size-full wp-image-232" /></p>
<p>Enlace &#8220;link&#8221; a  siguiente post  <a href="http://www.railsymas.com/2009/07/13/ajax-y-php-2-parte">Enlace Ajax  2 parte</a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.railsymas.com/2009/07/13/ajax-y-php-1-parte/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

