<?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>JPennington.net&#187; jQuery</title>
	<atom:link href="http://www.jpennington.net/category/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jpennington.net</link>
	<description>The online ramblings of a web programmer</description>
	<lastBuildDate>Mon, 15 Feb 2010 01:32:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>jQuery Before and After Plugin</title>
		<link>http://www.jpennington.net/2009/07/19/jquery-before-and-after-plugin/</link>
		<comments>http://www.jpennington.net/2009/07/19/jquery-before-and-after-plugin/#comments</comments>
		<pubDate>Sun, 19 Jul 2009 16:15:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[different sides]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://www.jpennington.net/?p=250</guid>
		<description><![CDATA[This is one cool plugin. This plugin for jQuery will allow you to create a before and after image that will allow you to scroll back and forth to view different sides of the image.  Take a look at the images to get a better look at how it works.



You can get the code [...]]]></description>
			<content:encoded><![CDATA[<p>This is one cool plugin. This plugin for jQuery will allow you to create a before and after image that will allow you to scroll back and forth to view different sides of the image.  Take a look at the images to get a better look at how it works.<br />
<span id="more-250"></span><br />
<img src="http://www.jpennington.net/wp-content/uploads/2009/07/before_after_right.jpg" alt="before and after right side" width="407" height="232" /></p>
<p><img src="http://www.jpennington.net/wp-content/uploads/2009/07/before_after_left.jpg" alt="before and after left side" width="405" height="231" /></p>
<p>You can get the code and documentation on how to do this from: <a href="http://www.catchmyfame.com/2009/06/25/jquery-beforeafter-plugin/">http://www.catchmyfame.com/2009/06/25/jquery-beforeafter-plugin/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jpennington.net/2009/07/19/jquery-before-and-after-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating A Virtual Keyboard With jQuery</title>
		<link>http://www.jpennington.net/2009/07/15/creating-a-virtual-keyboard-with-jquery/</link>
		<comments>http://www.jpennington.net/2009/07/15/creating-a-virtual-keyboard-with-jquery/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 21:54:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[interface]]></category>
		<category><![CDATA[key logging software]]></category>
		<category><![CDATA[keyboards]]></category>
		<category><![CDATA[passwords]]></category>
		<category><![CDATA[screen keyboard]]></category>
		<category><![CDATA[security breaches]]></category>
		<category><![CDATA[virtual keyboard]]></category>

		<guid isPermaLink="false">http://www.jpennington.net/?p=231</guid>
		<description><![CDATA[This is incredibly cool.  This plugin will allow you to have an on screen keyboard to enter data into a text box.  It is very simple, and could have a number of uses.  The best one that comes to mind is that you could provide your users an interface to enter their [...]]]></description>
			<content:encoded><![CDATA[<p>This is incredibly cool.  This plugin will allow you to have an on screen keyboard to enter data into a text box.  It is very simple, and could have a number of uses.  The best one that comes to mind is that you could provide your users an interface to enter their passwords in from this in lieu of their keyboards to help prevent any security breaches from their computers that could be infected with key logging software.  It could help make parts of your website more accessible for those users that have a touchscreen only device.  I am sure there are more reasons than these two, but you get the idea.<br />
<span id="more-231"></span></p>
<p style="text-align: center;"><img class="aligncenter" src="http://nettuts.s3.amazonaws.com/378_jqueryKeyboard/final.png" alt="on screen keyboard" width="600" height="431" /></p>
<p style="text-align: left;">You can download this code from <a href="http://net.tutsplus.com/tutorials/javascript-ajax/creating-a-keyboard-with-css-and-jquery/">http://net.tutsplus.com/tutorials/javascript-ajax/creating-a-keyboard-with-css-and-jquery/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jpennington.net/2009/07/15/creating-a-virtual-keyboard-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone-Like Passwords In jQuery</title>
		<link>http://www.jpennington.net/2009/07/12/iphone-like-passwords-in-jquery/</link>
		<comments>http://www.jpennington.net/2009/07/12/iphone-like-passwords-in-jquery/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 00:24:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[decaf]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[ipod touch]]></category>
		<category><![CDATA[minimal modifications]]></category>
		<category><![CDATA[necessary feature]]></category>
		<category><![CDATA[password fields]]></category>
		<category><![CDATA[passwords]]></category>
		<category><![CDATA[web application]]></category>

		<guid isPermaLink="false">http://www.jpennington.net/?p=228</guid>
		<description><![CDATA[Now I will be the first to admin that this is probably not the most necessary feature one could add to their web application, however sometimes these little features can show that your application has the polish of a mature application.

With this jQuery plugin you can make your password fields work the same way they [...]]]></description>
			<content:encoded><![CDATA[<p>Now I will be the first to admin that this is probably not the most necessary feature one could add to their web application, however sometimes these little features can show that your application has the polish of a mature application.<br />
<span id="more-228"></span><br />
With this jQuery plugin you can make your password fields work the same way they do on your iPhone/iPod Touch.  For those of you that do not use these devices, the last character you type is shown plain text, while the others are shown as the usual bullet.  The front end code requires very little code and on the processing end you have minimal modifications.  What you get is a cool effect that will make your application stand out from the others.</p>
<p>To download or find out more about this cool plug-in head over to: <a href="http://blog.decaf.de/2009/07/iphone-like-password-fields-using-jquery/">http://blog.decaf.de/2009/07/iphone-like-password-fields-using-jquery/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jpennington.net/2009/07/12/iphone-like-passwords-in-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gritter for jQuery</title>
		<link>http://www.jpennington.net/2009/07/11/gritter-for-jquery/</link>
		<comments>http://www.jpennington.net/2009/07/11/gritter-for-jquery/#comments</comments>
		<pubDate>Sun, 12 Jul 2009 01:02:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[bubble]]></category>
		<category><![CDATA[gritter]]></category>
		<category><![CDATA[jquery plugin]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[popup]]></category>

		<guid isPermaLink="false">http://www.jpennington.net/?p=203</guid>
		<description><![CDATA[Recently I have become a really hardcore fan of jQuery and the millions of plugins that are available.  Today I found one that I think is exceptionally useful.  It is called Gritter.  What this plugin allows you to do is create bubble like popup notifications for your website.  In looking at [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I have become a really hardcore fan of jQuery and the millions of plugins that are available.  Today I found one that I think is exceptionally useful.  It is called Gritter.  What this plugin allows you to do is create bubble like popup notifications for your website.  In looking at the code, it really could not be any easier to do.  Just a few lines of JavaScript code and you are good to go.  Go check it out at <a href="http://boedesign.com/2009/07/11/growl-for-jquery-gritter/">http://boedesign.com/2009/07/11/growl-for-jquery-gritter/</a>.  If you are looking for a very easy to implement popup notification system, this really could be exactly what you are looking for.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jpennington.net/2009/07/11/gritter-for-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ajax with jQuery</title>
		<link>http://www.jpennington.net/2009/01/31/ajax-with-jquery/</link>
		<comments>http://www.jpennington.net/2009/01/31/ajax-with-jquery/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 19:00:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[instructions]]></category>
		<category><![CDATA[jquery ajax]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.jpennington.net/?p=139</guid>
		<description><![CDATA[Here is the code we are using for today&#8217;s discussion on using jQuery to add Ajax to a website.  You can download a copy of everything required to do this project here.

Today&#8217;s example utilizes the PHP Calendar object I recently released along with a Javascript library called jQuery.  We will generate a calendar [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the code we are using for today&#8217;s discussion on using jQuery to add Ajax to a website.  You can download a copy of everything required to do this project <a href="http://www.jpennington.net/resources/php/ajax_calendar.zip">here</a>.<br />
<span id="more-139"></span><br />
Today&#8217;s example utilizes the PHP Calendar object I recently released along with a Javascript library called jQuery.  We will generate a calendar that will be able to switch month and years using Ajax.</p>
<h2>What is Ajax?</h2>
<p>Ajax is a way to call back to the webserver without refreshing the entire page.  This is done through Javascript.  There is a very lengthy discussion I could have with you about this, but there are better <a href="http://en.wikipedia.org/wiki/AJAX">resources</a> out there about how it actually works.  All you really need to know is that you can use it to call back to the webserver to do whatever you want to.  It can be used to add an item to a shopping cart or update a certain part of the page to streamline a process.</p>
<h2>On To The Code</h2>
<p>I am going to assume you know how the calendar object works.  If not please read the PHP Calendar Instructions Page.</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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>
<span style="color: #666666; font-style: italic;">// Import the PHP Calendar Object</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'object.calendar.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<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;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">switch</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'ajax_generate'</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$month</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'month'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$year</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'year'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$calendar</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Calendar<span style="color: #009900;">&#40;</span><span style="color: #000088;">$month</span><span style="color: #339933;">,</span> <span style="color: #000088;">$year</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$next_month</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$calendar</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getNextMonthYear</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$previous_month</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$calendar</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getPreviousMonthYear</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$calendar</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setNextMonthContent</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;a href=&quot;javascript:ajaxChangeCalendar('</span><span style="color: #339933;">.</span><span style="color: #000088;">$next_month</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'month'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">', '</span><span style="color: #339933;">.</span><span style="color: #000088;">$next_month</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'year'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">')&quot;&gt; &gt; &lt;/a&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$calendar</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setPreviousMonthContent</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;a href=&quot;javascript:ajaxChangeCalendar('</span><span style="color: #339933;">.</span><span style="color: #000088;">$previous_month</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'month'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">', '</span><span style="color: #339933;">.</span><span style="color: #000088;">$previous_month</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'year'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">')&quot;&gt; &lt; &lt;/a&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$calendar</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">generate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;html&gt;
&lt;head&gt;
	&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
&nbsp;
&lt;body&gt;
&nbsp;
	&lt;div id=&quot;calendar_group&quot;&gt;
		<span style="color: #000000; font-weight: bold;">&lt;?</span>
		<span style="color: #000088;">$month</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$year</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">2009</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$calendar</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Calendar<span style="color: #009900;">&#40;</span><span style="color: #000088;">$month</span><span style="color: #339933;">,</span> <span style="color: #000088;">$year</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$next_month</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$calendar</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getNextMonthYear</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$previous_month</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$calendar</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getPreviousMonthYear</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$calendar</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setNextMonthContent</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;a href=&quot;javascript:ajaxChangeCalendar('</span><span style="color: #339933;">.</span><span style="color: #000088;">$next_month</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'month'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">', '</span><span style="color: #339933;">.</span><span style="color: #000088;">$next_month</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'year'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">')&quot;&gt; &gt; &lt;/a&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$calendar</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setPreviousMonthContent</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;a href=&quot;javascript:ajaxChangeCalendar('</span><span style="color: #339933;">.</span><span style="color: #000088;">$previous_month</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'month'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">', '</span><span style="color: #339933;">.</span><span style="color: #000088;">$previous_month</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'year'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">')&quot;&gt; &lt; &lt;/a&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$calendar</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">generate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">?&gt;</span>
	&lt;/div&gt;
	<span style="color: #000000; font-weight: bold;">&lt;?</span>
	<span style="color: #000088;">$current_month</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$calendar</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getCurrentMonthYear</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">?&gt;</span>
	&lt;a href=&quot;javascript:ajaxChangeCalendar(<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$current_month</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'month'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>, <span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$current_month</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'year'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>)&quot;&gt;Current Month&lt;/a&gt;
	&lt;br/&gt;&lt;br/&gt;
	&lt;select name=&quot;move_to_month&quot; id=&quot;move_to_month&quot;&gt;
		<span style="color: #000000; font-weight: bold;">&lt;?</span>
		<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;=</span><span style="color: #cc66cc;">12</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;option value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$i</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$i</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/option&gt;<span style="color: #000000; font-weight: bold;">&lt;?</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">?&gt;</span>
	&lt;/select&gt;
	&lt;select name=&quot;move_to_year&quot; id=&quot;move_to_year&quot;&gt;
		<span style="color: #000000; font-weight: bold;">&lt;?</span>
		<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1900</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;=</span><span style="color: #cc66cc;">2020</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;option value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$i</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$i</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/option&gt;<span style="color: #000000; font-weight: bold;">&lt;?</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">?&gt;</span>
	&lt;/select&gt;
	&lt;input type=&quot;button&quot; value=&quot;Go To&quot; onclick=&quot;ajaxChangeCalendar( document.getElementById('move_to_month').value, document.getElementById('move_to_year').value )&quot; /&gt;
	&lt;script type=&quot;text/javascript&quot;&gt;
		function ajaxChangeCalendar( month, year ) {
			var redraw = $.ajax({
							type: &quot;POST&quot;,
							async: false,
							url: &quot;ajax_calendar.php&quot;,
							data: &quot;action=ajax_generate&amp;month=&quot; + month + &quot;&amp;year=&quot;+year
						}).responseText;
			$(&quot;#calendar_group&quot;).html(redraw);
		}
	&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

<p>The first thing I am going to bring your attention to is including the jQuery library on line 22.  So as you can see we are generating a calendar on lines 29-36.  The Next and Previous Month Content.  What we are going to put in there is a link that calls a Javascript function called ajaxChangeCalendar.You will also notice that we call this function on lines 42 and 59.  Line 42 moves the calendar to the current month and year, while the button on line 59 uses the values from the dropdown menu to determine where to go.</p>
<p>Now for the meat and potatoes of Ajax, the ajaxChangeCalendar function.  You will notice that we are utilizing jQuery&#8217;s Ajax functionality.  We set the type to Post (It could easily be Get if you wanted to), async is set to false, set the URL and the data that should be put into POST.  The $.ajax will do all the work for you.  It reaches out and takes the text it received and puts it into the variable redraw.</p>
<p>We then take that text and use replace the HTML in the calendar_group div with the value of redraw.</p>
<p>That seems simple right?  It really is.  Now let&#8217;s talk about how we get the data that goes into redraw.  This can be found on lines 4-18.  You will notice that it looks exactly the same as the code that generated the calendar initially, except for the fact that the month and possibly year have changed.  What is happening is that you are outputting the HTML code that will replace the HTML in the calendar_group div.</p>
<p>Also, notice the exit() being called on line 15.  We do not want any more HTML to output after the table.  Otherwise you will have the entire page put into the value of redraw and that will in turn redraw the entire page.  That would defeat the purpose of Ajax in the first place.</p>
<p>Anyways, I hope this helps to explain how you can use jQuery to put Ajax on your site.  This was a very simple example but you can do a whole lot more with Ajax if you put your mind to it.  If you have any questions post a comment or submit it in the contact form.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jpennington.net/2009/01/31/ajax-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	<img style='margin:0;padding:0;border:0;' width='1px' height='1px' src="http://www.jpennington.net/wp-content/plugins/mystat/mystat.php?act=time_load&id=52395&rnd=1194639948" /></channel>
</rss>
