<?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>Winn &#187; jQuery</title>
	<atom:link href="http://winn.ws/archives/tag/jquery/feed" rel="self" type="application/rss+xml" />
	<link>http://winn.ws</link>
	<description>Standards-based design &#38; development</description>
	<lastBuildDate>Wed, 01 Feb 2012 05:30:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>jQuery back button</title>
		<link>http://winn.ws/archives/951</link>
		<comments>http://winn.ws/archives/951#comments</comments>
		<pubDate>Sun, 31 Jul 2011 20:30:44 +0000</pubDate>
		<dc:creator>Greg Winn</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Jquery]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://winn.ws/?p=951</guid>
		<description><![CDATA[Ever needed to create a back button that acts like the browser back button? I rarely need this but in a latest project for an online assessment it was needed to allow the user to go back and look at the assessment content. I was using both jQuery and jQuery UI, so I will also [...]]]></description>
			<content:encoded><![CDATA[<p>Ever needed to create a back button that acts like the browser back button? I rarely need this but in a latest project for an online assessment it was needed to allow the user to go back and look at the assessment content. I was using both jQuery and jQuery UI, so I will also explain the class &#8220;button&#8221; along with &#8220;back&#8221;.<br />
<span id="more-951"></span></p>
<h3>The code</h3>
<p>Let&#8217;s cover the jQuery first.

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<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;.button&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">button</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.back'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</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>
		parent.<span style="color: #660066;">history</span>.<span style="color: #000066;">back</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</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: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Now the HTML</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;a class=&quot;button back&quot; href=&quot;#&quot;&gt;Back&lt;/a&gt;</pre></div></div>

<p>The above back link/button is now a functioning back button. Make sure you include both jQuery and jQuery UI.</p>
]]></content:encoded>
			<wfw:commentRss>http://winn.ws/archives/951/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Is an element visible?</title>
		<link>http://winn.ws/archives/890</link>
		<comments>http://winn.ws/archives/890#comments</comments>
		<pubDate>Wed, 02 Feb 2011 03:31:38 +0000</pubDate>
		<dc:creator>Greg Winn</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Jquery]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://winn.ws/?p=890</guid>
		<description><![CDATA[How to tell if an element is visible with jQuery jQuery makes it easy to determine if an element is visible or hidden with a simple function &#8216;is()&#8217; when used in conjunction with the element and a selector &#8216;:visible&#8217; you can now determine if in fact an element is visible or not. I will cover [...]]]></description>
			<content:encoded><![CDATA[<h3>How to tell if an element is visible with jQuery</h3>
<p>jQuery makes it easy to determine if an element is visible or hidden with a simple function &#8216;is()&#8217; when used in conjunction with the element and a selector &#8216;:visible&#8217; you can now determine if in fact an element is visible or not. I will cover some basic usage examples and show you how I implemented this in my own application.</p>
<p><span id="more-890"></span></p>
<h4>Getting started:</h4>
<p>Let&#8217;s include jquery.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span> src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;/js/jquery.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Now that jquery is included we can start using it&#8217;s wonderful magic! Below is some basic html:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;div id=&quot;holder&quot;&gt;
  &lt;p id=&quot;warning&quot;&gt;This is a warning!&lt;/p&gt;
&lt;/div&gt;</pre></td></tr></table></div>

<p>Let&#8217;s say we want to detect if #warning is visible or not we would simply call the element, then use the &#8216;is()&#8217; function in conjunction with &#8216;:visible&#8217; like so:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<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: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#warning'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066; font-weight: bold;">is</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">':visible'</span><span style="color: #009900;">&#41;</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;">'The Warning is visible'</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;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>As you see the alert would pop open and tell us the element is visible. It&#8217;s also very simply to revers the logic and see if it&#8217;s NOT visible:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<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: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#warning'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066; font-weight: bold;">is</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">':visible'</span><span style="color: #009900;">&#41;</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;">'The Warning is NOT visible'</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;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<h4>How I used this</h4>
<p>Well, my example was very similar to how i used this, i was looking for a flash message in rails, if the message was visible to the user then i wanted to to slide up after a few seconds. So i will use the same example above as it&#8217;s very close to mine.</p>
<p style="text-align:center;"><img src="http://d45jz936mo8n8.cloudfront.net/wp-content/uploads/2011/02/visible_howto_jquery.jpg" alt="Is an element visible?" /></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;div id=&quot;holder&quot;&gt;
  &lt;p id=&quot;warning&quot;&gt;You have logged in!&lt;/p&gt;
&lt;/div&gt;</pre></td></tr></table></div>

<p>As you see the warning is visible and now below is he JS to handle it:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<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: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#warning'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066; font-weight: bold;">is</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">':visible'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">// Delay 5 seconds then slide up</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#warning'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">delay</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'5000'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slideUp</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: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>You can add &#8216;delay()&#8217; function to almost anything, it beats out having to use a &#8216;setTimeOut&#8217; but that&#8217;s for another post.</p>
]]></content:encoded>
			<wfw:commentRss>http://winn.ws/archives/890/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Quick and Easy Way To Do Autocomplete</title>
		<link>http://winn.ws/archives/824</link>
		<comments>http://winn.ws/archives/824#comments</comments>
		<pubDate>Fri, 21 Jan 2011 21:15:41 +0000</pubDate>
		<dc:creator>Greg Winn</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://winn.ws/?p=824</guid>
		<description><![CDATA[Auto complete forms are now becoming essential to every day web development and knowing how to build such a tool will in some cases make you a hero! In the tutorial below i will be using PHP and jQuery. jQuery offers its own tool for this common problem in the jQuery UI library.]]></description>
			<content:encoded><![CDATA[<p><img src="http://d45jz936mo8n8.cloudfront.net/wp-content/uploads/2011/01/phpicon.jpg" class="codeicon" alt="php" /></p>
<p>This was written for a friend who was having issues with getting an auto complete form to work.</p>
<p>Auto complete forms are now becoming essential to every day web development and knowing how to build such a tool will in some cases make you a hero! In the tutorial below i will be using PHP and jQuery. jQuery offers its own tool for this common problem in the jQuery UI library.</p>
<p><span id="more-824"></span></p>
<blockquote>
<p>Autocomplete, when added to an input field, enables users to quickly find and select from a pre-populated list of values as they type, leveraging searching and filtering.</p>
<p>By giving an Autocomplete field focus or entering something into it, the plugin starts searching for entries that match and displays a list of values to choose from. By entering more characters, the user can filter down the list to better matches. This can be used to enter previous selected values, for example you could use Autocomplete for entering tags, to complete an address, you could enter a city name and get the zip code, or maybe enter email addresses from an address book. You can pull data in from a local and/or a remote source: Local is good for small data sets (like an address book with 50 entries), remote is necessary for big data sets, like a database with hundreds or millions of entries to select from.</p>
</blockquote>
<p>Lets get right into it. Lets say you need to pull a list of usernames from the database. So when the user types, it will start completing the username for them.
</p>
<h3>The HEAD of the document</h3>
<p>I will be including jQuery and jQuery UI into the page.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;script type=&quot;text/javascript&quot; src=&quot;http://code.jquery.com/jquery-1.4.4.min.js&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&nbsp;
&lt;!-- You may also include the jQuery css document --&gt;</pre></td></tr></table></div>

<h3>The HTML:</h3>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;input id=&quot;get_usernames&quot; name=&quot;username&quot; type=&quot;text&quot; /&gt;</pre></div></div>

<p></small>As you see this is a super basic just one input needed.</small></p>
<h3>The Javascript:</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="js" style="font-family:monospace;">$(&quot;#get_usernames&quot;).autocomplete({
	source: &quot;/search/get_username&quot;,
	minLength: 1
});</pre></td></tr></table></div>

<p>The above code is doing a few things first it’s looking to the id get_usernames (#get_usernames).  Now that we have found the element we want let’s add jQuery’s autocomplete to it. The autocomplete needs some basic stuff, first off lets tell it where to get the data (source: “/search/get_username”). Next lets tell it when to start looking, this should be an integer. In the sample i am telling autocomplete to look to the database after the user types in only 1 character. You can set this to what you need. (minLength: 1)</p>
<h3>The PHP (Using Codeigniter)</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> get_username<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$usernames</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'term'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$usernames</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">select</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'username'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">from</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'users'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">where_like</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'username'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'term'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #990000;">json_encode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$usernames</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Need to return key and value?</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;">function</span> get_username<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$usernames</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$UList</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</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: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'term'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$usernames</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">select</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'username'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">from</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'users'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">where_like</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'username'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'term'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$usernames</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">result</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$user</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$UList</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">username</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #990000;">json_encode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$UList</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>You will see that we are looking for a request named “term” this is default. After getting the value i am selecting usernames like the one entered into the text field. After grabbing the data i am returning it in a json format by using (json_encode). This will then send the data back to the UI showing a list of usernames like the one you typed in.</p>
<p>Hope that helped!</p>
]]></content:encoded>
			<wfw:commentRss>http://winn.ws/archives/824/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Google’s CDN links</title>
		<link>http://winn.ws/archives/762</link>
		<comments>http://winn.ws/archives/762#comments</comments>
		<pubDate>Tue, 30 Nov 2010 02:42:38 +0000</pubDate>
		<dc:creator>Greg Winn</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[web standards]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[prototype]]></category>
		<category><![CDATA[YUI]]></category>

		<guid isPermaLink="false">http://winn.ws/?p=762</guid>
		<description><![CDATA[Most of the websites I see, still host their JavaScript Library on their own server (Most, not all). Actually never have I ever seen any Web Development Blog hosting the library on their own server. They always use Google CDN, which is great because it has a number of advantages.]]></description>
			<content:encoded><![CDATA[<p>Most of the websites I see, still host their JavaScript Library on their own server (Most, not all). Actually never have I ever seen any Web Development Blog hosting the library on their own server. They always use Google CDN, which is great because it has a number of advantages:</p>
<p><span id="more-762"></span></p>
<ul>
<li>Google’s Content Distribution Network has libraries on their various servers across the world and if you use their CDN link, when a user’s browser resolves the URL, their browser will automatically download the file from the closest available server, which will be a much faster download than if you force a user to download the file from your host server in whichever country your website is hosted.</li>
<li>Google’s Content Distribution Network will save you a great deal of bandwidth if you have large traffic on your website and a limited bandwidth with your host.</li>
<li>There is a good chance that the Google hosted version of that library is already cached on the user’s browser cache, as lot of big websites and portals use Google’s CDN links including Google itself and Google’s servers instruct browsers to cache the file for one year if there are quite a few requests for the same hosted file.</li>
</ul>
<h3>How to use Google CDN</h3>
<p>Google’s CDN provides most of the popular, open source JavaScript Libraries with two ways of using each of them via the direct path in the script tags and via The Google AJAX Libraries API.</p>
<p>To use the Google AJAX Libraries API we need to include the Google “jsapi” script:</p>

<div class="wp_syntax"><div class="code"><pre class="jacascript" style="font-family:monospace;">&lt;script src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;</pre></div></div>

<p>The Google AJAX Libraries API provides a simple and powerful google.load() method which accepts two arguments, the first argument to google.load is the name of a library. The second argument is the version of the library:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script<span style="color: #339933;">&gt;</span>
google<span style="color: #339933;">.</span>load<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;jquery&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;1.3.2&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
google<span style="color: #339933;">.</span>load<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;jqueryui&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;1.7.1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    google<span style="color: #339933;">.</span>setOnLoadCallback<span style="color: #009900;">&#40;</span><span style="color: #000000; 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: #666666; font-style: italic;">// use this instead of:</span>
        <span style="color: #666666; font-style: italic;">/*
            $(document).ready(function(){  });
        */</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></pre></div></div>

<p>But to use this API, there is a different approach for the ready functions of all the libraries. For example, in the above code, we use google.setOnLoadCallback(function(){ }); instead of jQuery’s ready function. In-fact we use google.setOnLoadCallback(function(){ }); instead of all different library’s ready functions. This can be seen as a drawback or a good feature; I see it as a good feature as it gives me a single ready function for all libraries.</p>
<p>The second method to use Google’s CDN links is by the direct paths of the libraries in the script tags</p>
<p>Below is a list of all the JavaScript Libraries Google CDN provides with the direct paths and google.load implementation:</p>
<h4>jQuery</h4>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">name<span style="color: #339933;">:</span> jquery
versions<span style="color: #339933;">:</span> 1<span style="color: #339933;">.</span>2<span style="color: #339933;">.</span>3<span style="color: #339933;">,</span> 1<span style="color: #339933;">.</span>2<span style="color: #339933;">.</span>6<span style="color: #339933;">,</span> 1<span style="color: #339933;">.</span>3<span style="color: #339933;">.</span>0<span style="color: #339933;">,</span> 1<span style="color: #339933;">.</span>3<span style="color: #339933;">.</span>1<span style="color: #339933;">,</span> 1<span style="color: #339933;">.</span>3<span style="color: #339933;">.</span>2
load request<span style="color: #339933;">:</span> google<span style="color: #339933;">.</span>load<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;jquery&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;1.3.2&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
extras<span style="color: #339933;">:</span> uncompressed<span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> e<span style="color: #339933;">.</span>g<span style="color: #339933;">.,</span> google<span style="color: #339933;">.</span>load<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;jquery&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;1.3.2&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>uncompressed<span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
path<span style="color: #339933;">:</span> http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js</span>
path<span style="color: #009900;">&#40;</span>u<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js</span></pre></div></div>

<h4>jQuery UI</h4>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">name<span style="color: #339933;">:</span> jqueryui
versions<span style="color: #339933;">:</span> 1<span style="color: #339933;">.</span>5<span style="color: #339933;">.</span>2<span style="color: #339933;">,</span> 1<span style="color: #339933;">.</span>5<span style="color: #339933;">.</span>3<span style="color: #339933;">,</span> <span style="color:#800080;">1.6</span><span style="color: #339933;">,</span> 1<span style="color: #339933;">.</span>7<span style="color: #339933;">.</span>0<span style="color: #339933;">,</span> 1<span style="color: #339933;">.</span>7<span style="color: #339933;">.</span>1
load request<span style="color: #339933;">:</span> google<span style="color: #339933;">.</span>load<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;jqueryui&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;1.7.1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
extras<span style="color: #339933;">:</span> uncompressed<span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> e<span style="color: #339933;">.</span>g<span style="color: #339933;">.,</span> google<span style="color: #339933;">.</span>load<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;jqueryui&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;1.7.1&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>uncompressed<span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
path<span style="color: #339933;">:</span> http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.min.js</span>
path<span style="color: #009900;">&#40;</span>u<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.js</span>
note<span style="color: #339933;">:</span> This library depends on jquery<span style="color: #339933;">.</span> Before loading this module<span style="color: #339933;">,</span> you must load jquery<span style="color: #339933;">.</span> e<span style="color: #339933;">.</span>g<span style="color: #339933;">.:</span>
        google<span style="color: #339933;">.</span>load<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;jquery&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;1.3.2&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        google<span style="color: #339933;">.</span>load<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;jqueryui&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;1.7.1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h4>Prototype</h4>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">name<span style="color: #339933;">:</span> prototype
versions<span style="color: #339933;">:</span> 1<span style="color: #339933;">.</span>6<span style="color: #339933;">.</span>0<span style="color: #339933;">.</span>2<span style="color: #339933;">,</span> 1<span style="color: #339933;">.</span>6<span style="color: #339933;">.</span>0<span style="color: #339933;">.</span>3
load request<span style="color: #339933;">:</span> google<span style="color: #339933;">.</span>load<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;prototype&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;1.6.0.3&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
path<span style="color: #339933;">:</span> http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/prototype.js</span></pre></div></div>

<h4>script.aculo.us</h4>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">name<span style="color: #339933;">:</span> scriptaculous
versions<span style="color: #339933;">:</span> 1<span style="color: #339933;">.</span>8<span style="color: #339933;">.</span>1<span style="color: #339933;">,</span> 1<span style="color: #339933;">.</span>8<span style="color: #339933;">.</span>2
load request<span style="color: #339933;">:</span> google<span style="color: #339933;">.</span>load<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;scriptaculous&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;1.8.2&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
path<span style="color: #339933;">:</span> http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//ajax.googleapis.com/ajax/libs/scriptaculous/1.8.2/scriptaculous.js</span>
note<span style="color: #339933;">:</span> This library depends on Prototype<span style="color: #339933;">.</span> Before loading this module<span style="color: #339933;">,</span> you must load Prototype<span style="color: #339933;">.</span> e<span style="color: #339933;">.</span>g<span style="color: #339933;">.:</span>
        google<span style="color: #339933;">.</span>load<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;prototype&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;1.6&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        google<span style="color: #339933;">.</span>load<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;scriptaculous&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;1.8.2&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h4>SWFObject</h4>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">name<span style="color: #339933;">:</span> swfobject
versions<span style="color: #339933;">:</span> <span style="color:#800080;">2.1</span>
load request<span style="color: #339933;">:</span> google<span style="color: #339933;">.</span>load<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;swfobject&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;2.1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
extras<span style="color: #339933;">:</span> uncompressed<span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> e<span style="color: #339933;">.</span>g<span style="color: #339933;">.,</span> google<span style="color: #339933;">.</span>load<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;swfobject&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;2.1&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>uncompressed<span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
path<span style="color: #339933;">:</span> http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject.js</span>
path<span style="color: #009900;">&#40;</span>u<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject_src.js</span></pre></div></div>

<h4>Yahoo! User Interface Library (YUI)</h4>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">name<span style="color: #339933;">:</span> yui
versions<span style="color: #339933;">:</span> 2<span style="color: #339933;">.</span>6<span style="color: #339933;">.</span>0<span style="color: #339933;">,</span> 2<span style="color: #339933;">.</span>7<span style="color: #339933;">.</span>0
load request<span style="color: #339933;">:</span> load request<span style="color: #339933;">:</span> google<span style="color: #339933;">.</span>load<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;yui&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;2.7.0&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
extras<span style="color: #339933;">:</span> uncompressed<span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> e<span style="color: #339933;">.</span>g<span style="color: #339933;">.,</span> google<span style="color: #339933;">.</span>load<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;yui&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;2.7.0&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>uncompressed<span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
path<span style="color: #339933;">:</span> http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//ajax.googleapis.com/ajax/libs/yui/2.7.0/build/yuiloader/yuiloader-min.js</span>
path<span style="color: #009900;">&#40;</span>u<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//ajax.googleapis.com/ajax/libs/yui/2.7.0/build/yuiloader/yuiloader.js</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://winn.ws/archives/762/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Loading content with JQuery</title>
		<link>http://winn.ws/archives/224</link>
		<comments>http://winn.ws/archives/224#comments</comments>
		<pubDate>Mon, 30 Mar 2009 19:14:34 +0000</pubDate>
		<dc:creator>Greg Winn</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.winn.ws/?p=224</guid>
		<description><![CDATA[Loading content via Ajax is quick and easy with JQuery. If you have never used jQuery before you might think twice about it! Below is my html where we will load the content. 1 &#60;div id=&#34;LoadContent&#34;&#62;&#60;/div&#62; Now lets look at the javascript needed to load a remote page in. 1 $&#40;&#34;#LoadContent&#34;&#41;.load&#40;&#34;path/to/remote/file.php&#34;&#41;; After that is called [...]]]></description>
			<content:encoded><![CDATA[<p>Loading content via Ajax is quick and easy with JQuery. If you have never used jQuery before you might think twice about it!</p>
<p>Below is my html where we will load the content.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html4strct" style="font-family:monospace;">&lt;div id=&quot;LoadContent&quot;&gt;&lt;/div&gt;</pre></td></tr></table></div>

<p>Now lets look at the javascript needed to load a remote page in.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#LoadContent&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;path/to/remote/file.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>After that is called the contents of &#8220;file.php&#8221; would be loaded into the div above! Quick and easy way to include item into your app. You may also pass variables to the page like so:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#LoadContent&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;path/to/remote/file.php&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>id<span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <span style="color: #000066;">name</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Greg&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Hope this small tool helps change your mind about JQuery!</p>
]]></content:encoded>
			<wfw:commentRss>http://winn.ws/archives/224/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Browser detection using jQuery</title>
		<link>http://winn.ws/archives/199</link>
		<comments>http://winn.ws/archives/199#comments</comments>
		<pubDate>Tue, 10 Feb 2009 17:31:05 +0000</pubDate>
		<dc:creator>Greg Winn</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.winn.ws/?p=199</guid>
		<description><![CDATA[Browser sniffing is messy. There are a million ways to do it but none of them are particularly clean and most involve conditional statements such as &#8220;&#8221; for IE and various other CSS selector hacks for other browsers. It get around this common issue i am now using jQuery to add a class to my [...]]]></description>
			<content:encoded><![CDATA[<p>Browser sniffing is messy. There are a million ways to do it but none of them are particularly clean and most involve conditional statements such as &#8220;<!--[if condition]> HTML <![endif]-->&#8221; for IE and various other CSS selector hacks for other browsers.</p>
<p>It get around this common issue i am now using jQuery to add a class to my body tag.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">browser</span>.<span style="color: #660066;">msie</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'body'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'browserIE'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #006600; font-style: italic;">// Add the version number</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'body'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'browserIE'</span> <span style="color: #339933;">+</span> $.<span style="color: #660066;">browser</span>.<span style="color: #660066;">version</span>.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>If the user is using IE it will add a class to teh body tag like so:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;browserIE browserIE#&quot;</span>&gt;</span></pre></td></tr></table></div>

<blockquote><p>The &#8220;#&#8221; stands for the version of IE the user is running.</p></blockquote>
<p>You can now access elements on your page that neeed to be corrected for IE by calling:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.browserIE6</span> <span style="color: #cc00cc;">#myDiv</span> <span style="color: #00AA00;">&#123;</span>
     <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>This will work much better then current hacks. Hope that helps someone!!</p>
]]></content:encoded>
			<wfw:commentRss>http://winn.ws/archives/199/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cookies with JQuery</title>
		<link>http://winn.ws/archives/196</link>
		<comments>http://winn.ws/archives/196#comments</comments>
		<pubDate>Tue, 10 Feb 2009 05:16:32 +0000</pubDate>
		<dc:creator>Greg Winn</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.winn.ws/?p=196</guid>
		<description><![CDATA[So in some of my latest projects i dont have full source access, so i need to look for cookies the main application is setting. To do this i am using jQuery to look into the cookies and give me the value. Once i know the value i can then write a new cookie that [...]]]></description>
			<content:encoded><![CDATA[<p>So in some of my latest projects i dont have full source access, so i need to look for cookies the main application is setting. To do this i am using jQuery to look into the cookies and give me the value. Once i know the value i can then write a new cookie that the main application will see and use.</p>
<p>Below is an idea of what i am doing to read the cookies from the main application.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">cookie</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Cookie_name'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #003366; font-weight: bold;">var</span> MainAppCookie <span style="color: #339933;">=</span> $.<span style="color: #660066;">cookie</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Cookie_name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     $.<span style="color: #660066;">cookie</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'NewCookie_'</span> <span style="color: #339933;">+</span> MainAppCookie <span style="color: #339933;">,</span> <span style="color: #3366CC;">'Value'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>To use the $.cookie i am using a simple plugin for jQuery. This allows me to access the cookies quick and easy. Now if the application gives me a special cookie i can then delete my old ones by doing this&#8230;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">cookie</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Cookie_name'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">'Special Text'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     $.<span style="color: #660066;">cookie</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'MyCookie'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span><span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// This will delete the cookie</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://winn.ws/archives/196/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery to Ship with Visual Studio</title>
		<link>http://winn.ws/archives/163</link>
		<comments>http://winn.ws/archives/163#comments</comments>
		<pubDate>Wed, 01 Oct 2008 16:18:44 +0000</pubDate>
		<dc:creator>Greg Winn</dc:creator>
				<category><![CDATA[.NET 3.5 VB]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.winn.ws/?p=163</guid>
		<description><![CDATA[Microsoft will now be adopting jQuery for all it&#8217;s Ajax tools and any javascript related items. This is a big win for jQuery! We have two pieces of fantastic, albeit serendipitous, news today: Both Microsoft and Nokia are taking the major step of adopting jQuery as part of their official application development platform. Not only [...]]]></description>
			<content:encoded><![CDATA[<p>Microsoft will now be adopting jQuery for all it&#8217;s Ajax tools and any javascript related items. This is a big win for jQuery!</p>
<blockquote><p>We have two pieces of fantastic, albeit serendipitous, news today: Both Microsoft and Nokia are taking the major step of adopting jQuery as part of their official application development platform. Not only will they be using it for their corporate development but they will be providing it as a core piece of their platform for developers to build with&#8230;</p></blockquote>
<p><a href="http://jquery.com/blog/2008/09/28/jquery-microsoft-nokia/">Read more of this at the jQuery Blog&gt;&gt;</a></p>
]]></content:encoded>
			<wfw:commentRss>http://winn.ws/archives/163/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Database Caching 2/30 queries in 0.046 seconds using disk: basic
Object Caching 541/601 objects using disk: basic
Content Delivery Network via Amazon Web Services: CloudFront: d45jz936mo8n8.cloudfront.net

Served from: winn.ws @ 2012-02-05 05:43:53 -->
