<?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>Web Design Talk &#187; JQuery</title>
	<atom:link href="http://www.web-design-talk.co.uk/tag/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.web-design-talk.co.uk</link>
	<description>Web Design &#38; Development Blog</description>
	<lastBuildDate>Wed, 28 Jul 2010 21:50:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Reasons to let Google Host your JQuery Files</title>
		<link>http://www.web-design-talk.co.uk/81/reasons-to-let-google-host-your-jquery-files/</link>
		<comments>http://www.web-design-talk.co.uk/81/reasons-to-let-google-host-your-jquery-files/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 20:09:08 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[CDN]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.web-design-talk.co.uk/?p=81</guid>
		<description><![CDATA[It&#8217;s often the case that I see busy sites hosting copies of the JQuery library locally. E.g &#60;script src=&#34;/js/jQuery.min.js&#34; type=&#34;text/javascript&#34;&#62;&#60;/script&#62; The preferred and better way is to host your JQuery through Google E.g. &#60;script src=&#34;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&#34; type=&#34;text/javascript&#34;&#62;&#60;/script&#62; So, why is this better? Well there are several valid reasons: CDN (Content Delivery Network) &#8211; Google&#8217;s datacenters are [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s often the case that I see busy sites hosting copies of the JQuery library locally. E.g</p>
<pre class="brush: jscript;">&lt;script src=&quot;/js/jQuery.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</pre>
<p>The preferred and better way is to host your JQuery through Google E.g.</p>
<pre class="brush: jscript;">&lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</pre>
<p>So, why is this better? Well there are several valid reasons:</p>
<p><strong>CDN (Content Delivery Network) &#8211; </strong>Google&#8217;s datacenters are located over a range of locations and when a user requests content the closest location is automatically chosen. This is better because it does not force users to download from a single server location (E.g your server) and the chances are Google will be able to serve content faster than your webhost. A similar theory is used for the popularweb based game called <a href="http://www.quakelive.com" target="_blank">quakelive</a>. Usually <a href="http://en.wikipedia.org/wiki/Content_delivery_network" target="_blank">CDN</a>&#8216;s are a service you pay for, but you&#8217;re getting this free through Google!</p>
<p><strong>Less server load &#8211; </strong>When all your website&#8217;s files are located on a single server, downloading them simulainiously increases server load and some users will recieve delays while files download. By having an external location for your JQuery library the latter is not an issue.</p>
<p><strong>Improved caching &#8211; </strong>This is the biggest benefit as users will not have to re-download content. Hosting JQuery on your own server will cause a first time visitor to download the whole file, even if they have several copies of the same file from other sites. Through Google&#8217;s CDN, re-requests for the same file will result in a response to cache the file for up to one year, as it understands that it is a repeat request for a duplicate file.</p>
<p><strong>Local Bandwidth savings &#8211; </strong>by letting Google host the file for you, you are in essence saving bandwidth. For personal sites this may not be an issue, but busy sites will notice significant bandwidth savings.</p>
<p>Google actually suggests using a .load() function to load the library (see below), but this not only interrupts JQuery&#8217;s killer feature (document.ready), but also causes an extra <a href="http://en.wikipedia.org/wiki/HTTP_Requests" target="_blank">HTTP request</a>. Personally I prfer the old fashioned script method, even though there are <a href="http://stackoverflow.com/questions/208869/what-are-advantages-of-using-google-loadjquery-vs-direct-inclusion-of-ho" target="_blank">several other valid reasons</a> to use the .load() method.</p>
<pre class="brush: jscript;">
&lt;script type=&quot;text/javascript&quot;
        src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
  google.load(&quot;jquery&quot;, &quot;1.3.2&quot;);
  google.setOnLoadCallback(function() {
  });
&lt;/script&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.web-design-talk.co.uk/81/reasons-to-let-google-host-your-jquery-files/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Adding Unlimited Form Fields With JQuery and Saving to a Database</title>
		<link>http://www.web-design-talk.co.uk/58/adding-unlimited-form-fields-with-jquery-mysql/</link>
		<comments>http://www.web-design-talk.co.uk/58/adding-unlimited-form-fields-with-jquery-mysql/#comments</comments>
		<pubDate>Sat, 25 Jul 2009 20:36:49 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[associative array]]></category>
		<category><![CDATA[dynamic form fields]]></category>
		<category><![CDATA[pgp]]></category>
		<category><![CDATA[sprintf]]></category>

		<guid isPermaLink="false">http://www.web-design-talk.co.uk/?p=58</guid>
		<description><![CDATA[In this article I'll discuss how to add an unlimited number of additional form elements to a form and then save to a database. The latter part is the key here as a variety of tutorials exist on adding form elements, but I have yet to see anywhere that actually explains how to manipulate these added form fields. For example, how to get values to store them in a MySQL datbase. In the example we'll have a simple user signup form where the user can add multiple fields to describe their favourite websites.  The basic Form HTML is as follows (nothing amazing, just a simple html form):]]></description>
			<content:encoded><![CDATA[<p>In this article I&#8217;ll discuss how to add an unlimited number of additional form elements to a form and then save to a database. The latter part is the key here as a variety of tutorials exist on adding form elements, but I have yet to see anywhere that actually explains how to manipulate these added form fields. For example, how to get values to store them in a MySQL datbase. In the example we&#8217;ll have a simple user signup form where the user can add multiple fields to describe their favourite websites.  The basic Form HTML is as follows (nothing amazing, just a simple html form):</p>
<pre class="brush: xml; highlight: [10,11,12];">
&lt;script src=&quot;js/jquery.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&lt;h1&gt;New User Signup&lt;/h1&gt;
&lt;form action=&quot;index.php&quot; method=&quot;post&quot;&gt;

  &lt;label for=&quot;name&quot;&gt;Username:&lt;/label&gt;
  &lt;input id=&quot;name&quot; name=&quot;name&quot; type=&quot;text&quot; /&gt;
  &lt;label for=&quot;name&quot;&gt;Password:&lt;/label&gt;
  &lt;input id=&quot;password&quot; name=&quot;password&quot; type=&quot;text&quot; /&gt;

   &lt;div id=&quot;container&quot;&gt;
      &lt;a href=&quot;#&quot;&gt;&lt;span&gt;» Add your favourite links.....&lt;/span&gt;&lt;/a&gt;
   &lt;/div&gt;

   &lt;input id=&quot;go&quot; class=&quot;btn&quot; name=&quot;btnSubmit&quot; type=&quot;submit&quot; value=&quot;Signup&quot; /&gt;
&lt;/form&gt;
</pre>
<p>The only part that isn&#8217;t standard is highlighted above. This is simply the link users click to add additional form fields on the fly. To make that happen we&#8217;ll need some <a href="http://www.JQuery" target="_blank">JQuery</a>:</p>
<pre class="brush: jscript;">
var count = 0;
$(function(){
	$('p#add_field').click(function(){
		count += 1;
		$('#container').append('&lt;strong&gt;Link #' + count + '&lt;/strong&gt;'+ '&lt;input id=&quot;field_' + count + '&quot; name=&quot;fields[]' + '&quot; type=&quot;text&quot; /&gt;' );
	});
});</pre>
<p><span id="more-58"></span></p>
<p>Jquery makes it very easy to add for elements using the <a href="http://docs.jquery.com/Manipulation/append" target="_blank">append </a>method. As we need to assign a unique name to each additional input (as we are allowing the user to add an indefinite amount of inputs) I&#8217;ll use a variable to keep track of the number of inputs added. Whenever an input is added, the counter variable increments by one. Another thing to notice is how the fields are named using &#8216;txt[]&#8216;. This creates an array of field names. So now when we click the &#8216;add_field&#8217; link, a new input field is appended to the contianer div &#8211; <a href="http://www.web-design-talk.co.uk/examples/2/1/" target="_self">view example</a>.</p>
<p>The only other order of business is to save this information to a database. This would be easy if we had static field names for the whole form, but we don&#8217;t. We have the following:</p>
<pre class="brush: xml;">&lt;input id=&quot;name&quot; name=&quot;name&quot; type=&quot;text&quot; /&gt;
&lt;input id=&quot;password&quot; name=&quot;password&quot; type=&quot;text&quot; /&gt;
&lt;input id=&quot;field_1&quot; name=&quot;fields[]&quot; type=&quot;text&quot; /&gt;
&lt;input id=&quot;field_2&quot; name=&quot;fields[]&quot; type=&quot;text&quot; /&gt;
&lt;input id=&quot;field_3&quot; name=&quot;fields[]&quot; type=&quot;text&quot; /&gt;
.
.
.
etc.</pre>
<p>To capture this dynamic fields we&#8217;ll need to use a bit of PHP to loop through our posted array and saving the data using a many-many relationships using the following database structure &#8211; allowing a user to be associated with an unlimited number of websites:</p>
<div class="wp-caption alignnone" style="width: 510px"><img title="Data Structure For Users And Sites" src="http://www.web-design-talk.co.uk/images/users_sites.jpg" alt="Many-Many Data Structure For Users And Sites" width="500" height="125" /><p class="wp-caption-text">Many-Many Data Structure For Users And Sites</p></div>
<p>The following PHP code will grab our static and dynamic form values and insert into the above data structure. We&#8217;ll be using a class for the database to minimise the amount of code written. Firstly we&#8217;ll check if the forma has actually been submitted, grab the static values (username and password) and insert these into our users table:</p>
<pre class="brush: php;">//If form was submitted
if (isset($_POST['btnSubmit'])) {

	//create instance of database class
	$db = new mysqldb();
	$db-&amp;gt;select_db();

	//Insert static values into users table
	$sql_user = sprintf(&quot;INSERT INTO users (Username, Password) VALUES ('%s','%s')&quot;,
						mysql_real_escape_string($_POST['name']),
						mysql_real_escape_string($_POST['password']) );
	$result_user = $db-&amp;gt;query($sql_user);</pre>
<p>PHP&#8217;s <a href="http://www.php.net/sprintf">sprintf</a> function was used to format the sql query. I also escape input to prevent <a href="http://en.wikipedia.org/wiki/SQL_injection">nasty things from happening</a>. Now we need to check if the user has actually added any favourite websites in order to prevent a php error if we try to find non-existant values, if they have added a field we&#8217;ll need the user id number previously inserted into the users table, as we&#8217;ll need to insert this elsewhere later on:</p>
<pre class="brush: php;">//Check if user has actually added additional fields to prevent a php error
	if ($_POST['fields']) {

		//get last inserted userid
		$inserted_user_id = $db-&amp;gt;last_insert_id();</pre>
<p>Next we loop through the added form field values. This is where naming the field as in our append function as &#8216;txt[]&#8216; comes in, as all fields we added are submiited as an array called txt. Using a for each loop we can assign values to all dynamically added fields and save them to database. The $key is simply the fields name (field_1) and the $key is our actual value entered for that field. Now we know this, we can easily generate the sql statements within the loop. Firstly we add the website into the websites table, get the id of the inserted website and insert this into the the link table, using the userid from before. To finish, we display a confirmation message and disconnect from the database:</p>
<pre class="brush: php;">//Loop through added fields
		foreach ( $_POST['fields'] as $key=&amp;gt;$value ) {

			//Insert into websites table
			$sql_website = sprintf(&quot;INSERT INTO websites (Website_URL) VALUES ('%s')&quot;,
						    	   mysql_real_escape_string($value) );
			$result_website = $db-&amp;gt;query($sql_website);
			$inserted_website_id = $db-&amp;gt;last_insert_id();

			//Insert into users_websites_link table
			$sql_users_website = sprintf(&quot;INSERT INTO users_websites_link (UserID, WebsiteID) VALUES ('%s','%s')&quot;,
						    	   mysql_real_escape_string($inserted_user_id),
								   mysql_real_escape_string($inserted_website_id) );
			$result_users_website = $db-&amp;gt;query($sql_users_website);

		}

	} else {

		//No additional fields added by user

	}
	echo &quot;
&lt;h1&gt;User Added, &lt;strong&gt;&quot; . count($_POST['fields']) . &quot;&lt;/strong&gt; website(s) added for this user!&lt;/h1&gt;
&quot;;

	//disconnect mysql connection
	$db-&amp;gt;kill();</pre>
<p>As a result, our database should be populated as follows (these are screenshots from phpmyadmin):</p>
<div class="wp-caption alignnone" style="width: 510px"><img class=" " title="Many to many relationship" src="http://www.web-design-talk.co.uk/images/users_websites_data.jpg" alt="All our data tables are populated and the correct website and user id are inserted into the link table" width="500" height="278" /><p class="wp-caption-text">All our data tables are populated and the correct website and user id are inserted into the link table</p></div>
<p>You can view the <a href="http://www.web-design-talk.co.uk/examples/2/index-source.php">source of php file here</a> or <a href="http://www.web-design-talk.co.uk/examples/2/adding-form-elements-with-jquery.zip">download the original source files</a> (you&#8217;ll need to open classes/db.class.php and populate the sql variables with your own database details). The MySQL source to create the tables is also included in the source files.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.web-design-talk.co.uk/58/adding-unlimited-form-fields-with-jquery-mysql/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
		</item>
		<item>
		<title>Simple Ajax Content Loading With JQuery</title>
		<link>http://www.web-design-talk.co.uk/30/simple-ajax-content-loading-with-jquery/</link>
		<comments>http://www.web-design-talk.co.uk/30/simple-ajax-content-loading-with-jquery/#comments</comments>
		<pubDate>Sun, 19 Jul 2009 21:54:33 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[ajax content loading]]></category>
		<category><![CDATA[ajax load]]></category>
		<category><![CDATA[jquery .load()]]></category>

		<guid isPermaLink="false">http://www.web-design-talk.co.uk/?p=30</guid>
		<description><![CDATA[Occasionally it is useful to silently load content into an area on a webpage. For example, you may have a list of recent comments that you want to refresh every minute. Using a <a href="http://en.wikipedia.org/wiki/Meta_refresh">meta refresh</a> is one option, but this would cause the whole page to refresh, which could annoy the user. The solution is Ajax, where I'll reload the content silently without a single page refresh.]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignleft" style="width: 239px"><a href="http://www.jquery.com"><img title="JQuery Logo" src="http://www.web-design-talk.co.uk/images/jquery_logo.png" alt="JQuery.com Logo" width="229" height="74" /></a><p class="wp-caption-text">JQuery - JavaScript Framework</p></div>
<p>Occasionally it is useful to silently load content into an area on a webpage. For example, you may have a list of recent comments that you want to refresh every minute. Using a <a href="http://en.wikipedia.org/wiki/Meta_refresh">meta refresh</a> is one option, but this would cause the whole page to refresh, which could annoy the user. The solution is Ajax, where I&#8217;ll reload the content silently without a single page refresh. Even writing the simplist of Ajax functions is quite painful and requires a fair few <a href="http://www.ajaxlines.com/ajax/stuff/article/simple_ajax_javascript_function.php" target="_blank">lines of code</a> to get things done. To make things simpler we&#8217;ll use my favourite JavaScript Framework,  <a href="http://www.jquery.com" target="_blank">JQuery</a>.</p>
<p>The plan is to have dynamic content loaded via Ajax and refresh every x seconds. We&#8217;ll also have a loading image to show the user something is actually happening behind the scenes, as having nothing while the content is loading could make the user leave. The latter is especially important when querying large sets of data, where a delay is possible. You can get your own loading images from the <a href="http://www.ajaxload.info/" target="_blank">ajax loading image site</a>.Now we have a plan, we&#8217;ll get right into it.</p>
<p>First course of action is to setup our basic html page. It&#8217;s nothing amazing, simply a centered divider with a seperate divider for the loading graphic. Here&#8217;s the code we&#8217;ll be using (for simplicity I&#8217;ve used the style tag for the css, as opposed to having a seperate css file:</p>
<p><span id="more-30"></span></p>
<pre class="brush: css; html-script: true;">&lt;!--
	body, h1 {
		font-family: Verdana, Arial, Helvetica, sans-serif;
		font-size: 0.8em;
	}
	a {
		text-decoration: none;
		color: #333;
	}
	a:hover {
		color: #ff0000;
	}

	#ajax-content {
		height: auto;
		width: 400px;
		border: 5px solid #ccc;
		margin: 0 auto;
		padding: 10px;
	}
	#loading {
		width: 66px;
		margin: 0 auto;
	}
--&gt;
&lt;script src=&quot;jquery-1.2.3.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&lt;div id=&quot;loading&quot;&gt;
   &lt;img src=&quot;loader.gif&quot; alt=&quot;content is loading&quot; width=&quot;100&quot; height=&quot;100&quot; /&gt;
&lt;/div&gt;
</pre>
<p>The JQuery library has also been included in the header &#8211; you can download JQuery from the <a href="http://jquery.com/">official site</a>. Our actual content will be loaded into the div called &#8216;ajax-content&#8217;. For the content I&#8217;ve simply used an external php file that echos an <a href="http://www.w3schools.com/html/html_lists.asp">un-ordered list</a> and the current server time (you can then see that the content has been refreshed as the time changes). This has been done for simplicity, but you could easily query a database for information. PHP&#8217;s <a href="http://www.php.net/sleep">sleep function</a> was used to create a delay when loading the content, this way you can see something is actually happening. In reality you would never want to use sleep, as it simply delays loading times. The contents of the PHP file are as follows:</p>
<pre class="brush: php;">Last Updated: &quot;.date('h:i:s A').&quot;&quot;;
echo &quot;
&lt;h1&gt;Big List of Software&lt;/h1&gt;
&quot;;
echo &quot;
&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;http://link.com&quot;&gt;RmBarCode 1.00a&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://link.com&quot;&gt;ServerMask 3.0.4&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://link.com&quot;&gt;LinkDeny 1.1.0&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://link.com&quot;&gt;Drag Racer 1&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://link.com&quot;&gt;Method123 Educational 3.6&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://link.com&quot;&gt;Easy St. Tycoon 1.0&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://link.com&quot;&gt;iColorPicker 6.18&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://link.com&quot;&gt;USB Virus Scan 2.3&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://link.com&quot;&gt;AWP Light FREE 2.0&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://link.com&quot;&gt;ZipEnable 3.0.2&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://link.com&quot;&gt;w3compiler 1.1.2&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://link.com&quot;&gt;Remote Reboot 2.0&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://link.com&quot;&gt;Pixeur 2.9.0.15&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://link.com&quot;&gt;Mailing Master 2.0&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://link.com&quot;&gt;Rewards Multiply 2.0&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&quot;;
?&amp;gt;</pre>
<p>Now enters the magic, the JQuery. The following code is placed in script tags in the document head, I&#8217;ll explain line by line how this works.</p>
<pre class="brush: jscript;">function fetchAjaxContent() {
	var numRand = Math.floor(Math.random()*101);
	$('#ajax-content').load('ajax.php?UID=' + numRand);
}</pre>
<p>For simplicity I&#8217;ll add a generic function that load&#8217;s the contents of our PHP file (ajax.php) via Ajax. This simply uses <a href="http://docs.jquery.com/Ajax/load">JQuery&#8217;s load function</a> to load the contents of ajax.php. The random number is placed in the querystring to stop Internet Explorer caching the results. The latter could also be done server side via adding the below to ajax.php:</p>
<pre class="brush:php">header("cache-control: no-cache");</pre>
<p>The following code is placed inside JQuery&#8217;s document ready function. Firstly we hide the divider that will contain the ajax content. using more of JQuery&#8217;s built in ajax function, I use the <a href="http://docs.jquery.com/Ajax/ajaxStart">ajaxStart </a> function (that is executed whenever an AJAX request begins and there is none already active). In this instance the loading image is simply displayed. The opposite function used is <a href="http://docs.jquery.com/Ajax/ajaxStop">ajaxStop </a> (executed whenever all AJAX requests have ended) to hide the loading image and show the loaded content. Finally, we&#8217;ll call our function from previously, &#8216;fetchAjaxContent()&#8217; from within the JavaScript setInterval function (calls a function at specified intervals in milliseconds, every 5 seconds is used in this example). The complete code for the document ready looks like this:</p>
<pre class="brush: jscript;">$(document).ready(function() {

        $('#ajax-content').hide();

	$(&quot;#loading&quot;).ajaxStart(function(){
		$('#ajax-content').slideUp();
                $(this).show();
	});

	$(&quot;#loading&quot;).ajaxStop(function(){
	         $(this).hide();
	         $(&quot;#ajax-content&quot;).slideDown();
	}); 

	setInterval(&quot;fetchAjaxContent()&quot;, 5000);

});</pre>
<p>That&#8217;s it basically. You can now <a href="http://www.web-design-talk.co.uk/examples/1/" target="_self">view a working example</a> or <a href="http://www.web-design-talk.co.uk/examples/1/ajax-content-loading.zip">download the source files</a>. Notice how after each refresh, 5 seconds has elapsed in the printed output.</p>
<p>Thanks for reading!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.web-design-talk.co.uk/30/simple-ajax-content-loading-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>301 Redirects for SEO Using htaccess</title>
		<link>http://www.web-design-talk.co.uk/20/301-redirects-for-seo-using-htaccess/</link>
		<comments>http://www.web-design-talk.co.uk/20/301-redirects-for-seo-using-htaccess/#comments</comments>
		<pubDate>Sun, 12 Jul 2009 21:08:07 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[SEO]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Jquery Framework]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[useability]]></category>

		<guid isPermaLink="false">http://www.web-design-talk.co.uk/?p=20</guid>
		<description><![CDATA[Google treats www.website.com and website.com as two totally different websites. This is very bad for your (or even a client's) website as it may lead to duplicate content and different pageranks to those sites.  This is how Google "canonicalizes" the url and is very bad from an SEO standpoint.]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignleft" style="width: 130px"><img title="404 vs 301" src="http://www.web-design-talk.co.uk/images/404-vs-301-redirect.jpg" alt="301 Redirects Prevent 404 Errors" width="120" height="120" /><p class="wp-caption-text">301 Redirects Prevent 404 Errors</p></div>
<p>Google treats www.website.com and website.com as two totally different websites. This is very bad for your (or even a client&#8217;s) website as it may lead to duplicate content and different pageranks to those sites.  This is how Google &#8220;canonicalizes&#8221; the url and is very bad from an SEO standpoint.</p>
<p>In essence, a web server could return totally different results for each of those pages. I have also encountered the situation where clients have set their preferred domain in Google webmaster tools, have given out the opposite version for SEM and wonder why they don&#8217;t see results <img src='http://www.web-design-talk.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> You can easily check the above by using the &#8220;site:&#8221; operator in Google search. E.g. site:www.website.com and site:website.com</p>
<p>You can use &#8220;mod rewrite&#8221; rules as a powerful method for redirecting many URLs from one location to another.  This is a simple server level technique for handling redirects. The way people handle this canonicalization issue is purely a personal choice, although the below method can be altered for directing to the none www version of the url.</p>
<p>The .htaccess file is simply an ASCII file created with any normal text editor. You need to save the file as &#8216;.htaccess&#8217; (no filename, .htaccess is the extension!). Open you newly created .htaccess file in your favoured text editor and add the following lines of code, replacing domain.com with your domain:</p>
<pre class="brush: xml;">
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]</pre>
<p>Upload the .htaccess file to the root folder of your website and you&#8217;re done. All your traffic will be permanently redirected from a non-www version of your website to a www version of your website. To do the opposite (direct all traffic to the non www version use the below code in the .htaccess file):</p>
<pre class="brush: xml;">RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain.com
RewriteRule (.*) http://domain.com/$1 [R=301,L]
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.web-design-talk.co.uk/20/301-redirects-for-seo-using-htaccess/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Resources</title>
		<link>http://www.web-design-talk.co.uk/resources/</link>
		<comments>http://www.web-design-talk.co.uk/resources/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 15:55:45 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Jquery Framework]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[useability]]></category>
		<category><![CDATA[web design]]></category>

		<guid isPermaLink="false">http://www.web-design-talk.co.uk/?page_id=5</guid>
		<description><![CDATA[Content Soon&#8230;.]]></description>
			<content:encoded><![CDATA[<p>Content Soon&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.web-design-talk.co.uk/resources/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Who?</title>
		<link>http://www.web-design-talk.co.uk/about/</link>
		<comments>http://www.web-design-talk.co.uk/about/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 21:02:01 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Jquery Framework]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[useability]]></category>
		<category><![CDATA[web design]]></category>

		<guid isPermaLink="false">http://www.web-design-talk.co.uk/?page_id=2</guid>
		<description><![CDATA[http://www.web-design-talk.co.uk I am a full-time developer for an internet company located in Staffordshire (Midlands) of the United Kingdom. I have been designing and coding websites for over 2 years using PHP, ASP, JQuery, XHTML, CSS and JavaScript. I have been lucky to work on a wide variety of projects from small intranet sites, personal websites [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.web-design-talk.co.uk/">http://www.web-design-talk.co.uk</a></p>
<p>I am a full-time developer for an internet company located in Staffordshire (Midlands) of the United Kingdom. I have been designing and coding websites for over 2 years using PHP, ASP, <a title="JQuery.com" href="http://www.jquery.com">JQuery</a>, XHTML, CSS and JavaScript. I have been lucky to work on a wide variety of projects from small intranet sites, personal websites and full e-commerce storefronts. I am currently available on a limited basis for interesting freelance work. I also offer the following services (although you can contact me via email to discuss web services not mentioned here):</p>
<ul>
<li>SEO / Website Marketing / Offsite SEO</li>
<li>Bespoke Website Design/Development</li>
<li>Website Updates</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.web-design-talk.co.uk/about/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
