<?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>Farid Hadi</title>
	<atom:link href="http://www.faridhadi.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.faridhadi.com</link>
	<description>Freelance Web Developer</description>
	<lastBuildDate>Tue, 04 Sep 2012 15:36:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Theme Launch: Amplitude Responsive Multipurpose WordPress Theme</title>
		<link>http://www.faridhadi.com/theme-launch-amplitude-responsive-multipurpose-wordpress-theme/</link>
		<comments>http://www.faridhadi.com/theme-launch-amplitude-responsive-multipurpose-wordpress-theme/#comments</comments>
		<pubDate>Tue, 04 Sep 2012 15:36:23 +0000</pubDate>
		<dc:creator>Farid Hadi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.faridhadi.com/?p=123</guid>
		<description><![CDATA[Amplitude is the name of the latest kickass product launched in co-op by UnlimitDesign and myself. It&#8217;s a Responsive Multipurpose / Business WordPress theme with an options panel that lets you set the color of every element, choose between 40+ fonts and create virtually an unlimited number of layouts using a combination of options and [...]]]></description>
			<content:encoded><![CDATA[<p><small></small><br />
<iframe src="http://player.vimeo.com/video/48690596" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></p>
<p><a href="http://themeforest.net/item/amplitude-responsive-multipurpose-wordpress-theme/2950518?ref=FaridHadi" title="Amplitude - Responsive Multipurpose WordPress Theme">Amplitude</a> is the name of the latest kickass product launched in co-op by <a href="http://www.udfrance.com/" title="UnlimitDesign">UnlimitDesign</a> and myself. It&#8217;s a Responsive Multipurpose / Business WordPress theme with an options panel that lets you set the color of every element, choose between 40+ fonts and create virtually an unlimited number of layouts using a combination of options and shortcodes.<br />
<span id="more-123"></span><br />
Check out the promo video above and head over to ThemeForest to check out the demos: <a href="http://themeforest.net/item/amplitude-responsive-multipurpose-wordpress-theme/2950518?ref=FaridHadi" title="Amplitude - Responsive Multipurpose WordPress Theme">Amplitude &#8211; Responsive Multipurpose WordPress Theme</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.faridhadi.com/theme-launch-amplitude-responsive-multipurpose-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Theme Launch: Voltage Studio HTML5 Site Template</title>
		<link>http://www.faridhadi.com/theme-launch-voltage-studio-html5-site-template/</link>
		<comments>http://www.faridhadi.com/theme-launch-voltage-studio-html5-site-template/#comments</comments>
		<pubDate>Sun, 12 Feb 2012 00:09:49 +0000</pubDate>
		<dc:creator>Farid Hadi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.faridhadi.com/?p=102</guid>
		<description><![CDATA[Update: Voltage is now also available as a Responsive WordPress Theme. Christian Lundgren is an awesome designer and owner of UnlimitDesign. Together we&#8217;ve launched a premium HTML5 site template that&#8217;s great for design and photography studios. The template, that comes in two versions, not only looks great but also has a bunch of neat JavaScript [...]]]></description>
			<content:encoded><![CDATA[<p><small></small><br />
<img src="http://www.faridhadi.com/images/voltage-studio-html5-template/voltage-studio-html5-site-template.jpg" alt="Voltage Studio HTML5 Site Template" /></p>
<div style="margin:0 0 20px; padding:10px; width:478px; border:1px solid #ccc; background:#eee;"><strong>Update:</strong> <a href="http://themeforest.net/item/voltage-creative-responsive-wordpress-theme/2532838?ref=FaridHadi" title="Voltage - Creative Responsive WordPress Theme">Voltage is now also available as a Responsive WordPress Theme</a>.</div>
<p>Christian Lundgren is an awesome designer and owner of <a title="UnlimitDesign" href="http://www.udfrance.com/">UnlimitDesign</a>. Together we&#8217;ve launched a premium HTML5 site template that&#8217;s great for design and photography studios.<br />
<span id="more-102"></span><br />
The template, that comes in two versions, not only looks great but also has a bunch of neat JavaScript effects like a full width slideshow that supports images and video, a sliding footer, a really cool rollover effect for thumbnails in the portfolio section and much more.</p>
<p>Head over to ThemeForest and check it out: <a title="Voltage Minimalist Studio HTML5 Template" href="http://themeforest.net/item/voltage-minimalist-studio-html-5-template/1557578?ref=FaridHadi">Voltage Minimalist Studio HTML5 Template</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.faridhadi.com/theme-launch-voltage-studio-html5-site-template/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>10 free WordPress themes</title>
		<link>http://www.faridhadi.com/10-free-wordpress-themes/</link>
		<comments>http://www.faridhadi.com/10-free-wordpress-themes/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 23:52:58 +0000</pubDate>
		<dc:creator>Farid Hadi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.faridhadi.com/?p=64</guid>
		<description><![CDATA[I decided to go hunting for some great looking WordPress themes that I could share with my readers and after hours and hours of digging around the web I finally came out with 10 free WP themes that I thought were worthy of a mention. Without further ado, let me introduce you to today&#8217;s list [...]]]></description>
			<content:encoded><![CDATA[<p><small></small><br />
<img src="/images/10-free-wordpress-themes/10-free-wordpress-themes.jpg" alt="10 Free WordPress Themes" /><br />
I decided to go hunting for some great looking WordPress themes that I could share with my readers and after hours and hours of digging around the web I finally came out with 10 free WP themes that I thought were worthy of a mention.<br />
<span id="more-64"></span><br />
Without further ado, let me introduce you to today&#8217;s list of Free WordPress Themes!</p>
<h3><a href="http://wordpress.org/extend/themes/motion" title="Motion">Motion</a></h3>
<p>Dark and colorful theme with sweet transparency characteristics. Drop-down categories menu, 2-column layout and widget-ready footer and sidebar.</p>
<p><a href="http://wordpress.org/extend/themes/motion" title="Motion"><img src="/images/10-free-wordpress-themes/motion.jpg" alt="Free WordPress Theme: Motion" /></a></p>
<h3><a href="http://wordpress.org/extend/themes/pretty-spots" title="Pretty Spots">Pretty Spots</a></h3>
<p>A highly widgetized (5 unique areas to include widgets!), dark theme. Validates XHTML Transitional. Works with WordPress 2.8.</p>
<p><a href="http://wordpress.org/extend/themes/pretty-spots" title="Pretty Spots"><img src="/images/10-free-wordpress-themes/pretty-spots.jpg" alt="Free WordPress Theme: Pretty Spots" /></a></p>
<h3><a href="http://wordpress.org/extend/themes/pixel" title="Pixel">Pixel</a></h3>
<p>Dark WP theme with 2-3 column layout, dropdown categories menu, multiple widget-ready placement and Feedburner email form integrated, easy to customize.</p>
<p><a href="http://wordpress.org/extend/themes/pixel" title="Pixel"><img src="/images/10-free-wordpress-themes/pixel.jpg" alt="Free WordPress Theme: Pixel" /></a></p>
<h3><a href="http://wordpress.org/extend/themes/mystique" title="Mystique">Mystique</a></h3>
<p>Feature-packed theme with a solid design, built-in widgets and a intuitive theme settings interface.</p>
<p><a href="http://wordpress.org/extend/themes/mystique" title="Mystique"><img src="/images/10-free-wordpress-themes/mystique.jpg" alt="Free WordPress Theme: Mystique" /></a></p>
<h3><a href="http://wordpress.org/extend/themes/colorful-paint" title="Colorful Paint">Colorful Paint</a></h3>
<p>Sidebar and Widget Ready. Compatible with WordPress 2.9. W3C Validated CSS &#038; HTML, Compatible with IE and Firefox.</p>
<p><a href="http://wordpress.org/extend/themes/colorful-paint" title="Colorful Paint"><img src="/images/10-free-wordpress-themes/colorful-paint.jpg" alt="Free WordPress Theme: Colorful Paint" /></a></p>
<h3><a href="http://wordpress.org/extend/themes/color3" title="Color3">Color3</a></h3>
<p>Colorful clean and stylish theme with Special feature &#8211; choose out of five different colorful backgrounds. Two columns, right sidebar, dropdown menu and widget-ready.</p>
<p><a href="http://wordpress.org/extend/themes/color3" title="Color3"><img src="/images/10-free-wordpress-themes/color3.jpg" alt="Free WordPress Theme: Color3" /></a></p>
<h3><a href="http://wordpress.org/extend/themes/urban-view" title="Urban View">Urban View</a></h3>
<p>Unique dark grungy theme with two-column layout suitable for a wide range of bloggers. Tested in all major browsers.</p>
<p><a href="http://wordpress.org/extend/themes/urban-view" title="Urban View"><img src="/images/10-free-wordpress-themes/urban-view.jpg" alt="Free WordPress Theme: Urban View" /></a></p>
<h3><a href="http://wordpress.org/extend/themes/elegant-grunge" title="Elegant Grunge">Elegant Grunge</a></h3>
<p>An unwashed yet crisp theme with a feature footer, styled image frames, a page template with a uniquely configurable sidebar and a photoblog tag page.</p>
<p><a href="http://wordpress.org/extend/themes/elegant-grunge" title="Elegant Grunge"><img src="/images/10-free-wordpress-themes/elegant-grunge.jpg" alt="Free WordPress Theme: Elegant Grunge" /></a></p>
<h3><a href="http://wordpress.org/extend/themes/smooth" title="Smooth">Smooth</a></h3>
<p>This widget-ready theme is dedicated to writers. Its simplicity, light gray background and large fonts put the content ahead. Nothing useless, just fine typography and a touch of colors.</p>
<p><a href="http://wordpress.org/extend/themes/smooth" title="Smooth"><img src="/images/10-free-wordpress-themes/smooth.jpg" alt="Free WordPress Theme: Smooth" /></a></p>
<h3><a href="http://wordpress.org/extend/themes/pyrmont-v2" title="Pyrmont V2">Pyrmont V2</a></h3>
<p>This dark WordPress theme is widget-ready and supports sticky posts. It has a dropdown menu and you can link to your twitter account from the navigation bar.</p>
<p><a href="http://wordpress.org/extend/themes/pyrmont-v2" title="Pyrmont V2"><img src="/images/10-free-wordpress-themes/pyrmont-v2.jpg" alt="Free WordPress Theme: Pyrmont V2" /></a></p>
<p>And there you have it – 10 free WordPress themes I think you should have a look at.<br />
Do you know of any other nice free WordPress themes? Share them with us in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.faridhadi.com/10-free-wordpress-themes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Submitting a form without reloading the page using jQuery and AJAX</title>
		<link>http://www.faridhadi.com/submitting-a-form-without-reloading-the-page-using-jquery-and-ajax/</link>
		<comments>http://www.faridhadi.com/submitting-a-form-without-reloading-the-page-using-jquery-and-ajax/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 06:17:13 +0000</pubDate>
		<dc:creator>Farid Hadi</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.faridhadi.com/?p=51</guid>
		<description><![CDATA[In this tutorial I&#8217;ll show you how to submit a form without reloading the page using jQuery and AJAX. Adding this kind of functionality to your forms will improve the user experience for your visitors as they won&#8217;t need to sit and wait for the entire page to reload when the form is submitted. Here [...]]]></description>
			<content:encoded><![CDATA[<p><small></small><br />
<img src="http://www.faridhadi.com/images/jquery-ajax-form/submitting-a-form-without-reloading-the-page-using-jquery-and-ajax.jpg" alt="Submitting a form without reloading the page using jQuery and Ajax" /><br />
In this tutorial I&#8217;ll show you how to submit a form without reloading the page using jQuery and AJAX. Adding this kind of functionality to your forms will improve the user experience for your visitors as they won&#8217;t need to sit and wait for the entire page to reload when the form is submitted.<br />
<span id="more-51"></span><br />
<a href="http://www.faridhadi.com/demo/jquery-ajax-form/" title="jQuery AJAX Form demo">Here is a demo</a> of the jQuery AXAJ Form we&#8217;re going to build in this tutorial and if you would like to you can also <a href="http://www.faridhadi.com/demo/jquery-ajax-form/jquery-ajax-form.zip" title="jQuery AJAX Form zip file">download a zip file</a> containing all the files.</p>
<h3>The HTML Form</h3>
<p>Let&#8217;s start by creating the HTML form. Below is the code that I have used for this tutorial.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;contactForm&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;contactForm&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>Contact form<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;php/submit-form.php&quot;</span> <span style="color: #000066;">method</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;post&quot;</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;name&quot;</span>&gt;</span>Name *<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;name&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;name&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;txtFld&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;errorName&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;formError&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;email&quot;</span>&gt;</span>Email *<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;email&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;email&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;txtFld&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;errorEmail&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;formError&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;subject&quot;</span>&gt;</span>Subject<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;subject&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;subject&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;txtFld&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;errorSubject&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;formError&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;message&quot;</span>&gt;</span>Message *<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">textarea</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;message&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;message&quot;</span> <span style="color: #000066;">cols</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;30&quot;</span> <span style="color: #000066;">rows</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;5&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;txtAra&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">textarea</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;errorMessage&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;formError&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Send&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;formProgress&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;formProgress&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>Notice that I have added <em>span</em> tags with IDs after each text-field and one after the submit button. We&#8217;ll need these for error messages so don&#8217;t leave them out. The rest of it is a straight forward form marked up in an unordered list with its <em>action</em> set to <em>submit-form.php</em> and <em>method</em> set to <em>post</em>.</p>
<p>Once we have the HTML in place we need to style it using CSS. I&#8217;m not going to walk you through this step as you can style it as you wish. If you would like to see the styles I created for the form you can download the zip file above.</p>
<h3>The PHP</h3>
<p>We&#8217;ll need two separate PHP files, one for the AJAX call and one which will process the form if JavaScript is disabled. This way we ensure that the form works fine even for the low percentage of people surfing with JavaScript turned off. For the purpose of this tutorial I&#8217;ve made both these files identical but you can, and really should, change the &#8220;non-ajax&#8221; PHP script, <em>submit-form.php</em>, to handle the process better than just outputting text on an empty page.</p>
<p>Here is the PHP code we need for the AJAX call. I&#8217;ve saved this code in a file named <em>submit-form-ajax.php</em></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'email'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'message'</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: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Error: Missing variables'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$name</span><span style="color: #339933;">=</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$email</span><span style="color: #339933;">=</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'email'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$subject</span><span style="color: #339933;">=</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'subject'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$message</span><span style="color: #339933;">=</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'message'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$to</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'your@email.com'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$headers</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'From: '</span><span style="color: #339933;">.</span><span style="color: #000088;">$email</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #339933;">.</span>
	<span style="color: #0000ff;">'Reply-To: '</span><span style="color: #339933;">.</span><span style="color: #000088;">$email</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #339933;">.</span>
	<span style="color: #0000ff;">'X-Mailer: PHP/'</span> <span style="color: #339933;">.</span> <span style="color: #990000;">phpversion</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$subject</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$subject</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$body</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'You have got a new message from the contact form on your website.'</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$body</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">'Name: '</span><span style="color: #339933;">.</span><span style="color: #000088;">$name</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$body</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">'Email: '</span><span style="color: #339933;">.</span><span style="color: #000088;">$email</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$body</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">'Subject: '</span><span style="color: #339933;">.</span><span style="color: #000088;">$subject</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$body</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">'Message: '</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$message</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mail</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$to</span><span style="color: #339933;">,</span> <span style="color: #000088;">$subject</span><span style="color: #339933;">,</span> <span style="color: #000088;">$body</span><span style="color: #339933;">,</span> <span style="color: #000088;">$headers</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Mail sent'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Error: Mail failed'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>The first few lines of code are an <em>if</em> statement to ensure that the <em>name</em>, <em>email</em> and <em>message</em> fields weren&#8217;t left blank by the user. If any of them are blank the script will terminate and output an error.</p>
<p>After that we are assigning the values of the fields to variables (<em>$name</em>, <em>$email</em>, <em>$subject</em> and <em>$message</em>) for easier use later in the script.</p>
<p>In the line after that we set a variable called <em>$to</em>. It&#8217;s value is the email address where we want the form sent.<br />
<strong>Note:</strong> Don&#8217;t forget to change your@email.com to your email address.</p>
<p>After that we are simply setting the values for the subject and body of the email.</p>
<p>In the last few lines we are using PHP&#8217;s <em>mail</em> function in an <em>if</em> statement. Now if the email is sent the script will output the message &#8220;Mail sent&#8221; or else, if it fails, it will terminate and output an error message. We&#8217;ll be making use of the &#8220;Mail sent&#8221; message later on in our jQuery AJAX call.</p>
<h3>The jQuery &#038; AJAX</h3>
<p>Now lets get to the jQuery and AJAX part of this tutorial. We&#8217;ll be using jQuery to display messages to the user, validate the form on the client side and to submit the data using AJAX.</p>
<p>Below is the jQuery code I have written to do all of the above. It might look like quite a bit but don&#8217;t worry I&#8217;ll walk you through it.</p>

<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;">'#contactForm #submit'</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>
		<span style="color: #006600; font-style: italic;">// Fade in the progress bar</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #formProgress'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #formProgress'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;img src=&quot;images/ajax-loader.gif&quot; /&gt; Sending&amp;hellip;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #formProgress'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeIn</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #006600; font-style: italic;">// Disable the submit button</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #submit'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;disabled&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;disabled&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #006600; font-style: italic;">// Clear and hide any error messages</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm .formError'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #006600; font-style: italic;">// Set temaprary variables for the script</span>
		<span style="color: #003366; font-weight: bold;">var</span> isFocus<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> isError<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
		<span style="color: #006600; font-style: italic;">// Get the data from the form</span>
		<span style="color: #003366; font-weight: bold;">var</span> <span style="color: #000066;">name</span><span style="color: #339933;">=</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #name'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> email<span style="color: #339933;">=</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #email'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> subject<span style="color: #339933;">=</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #subject'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> message<span style="color: #339933;">=</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #message'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #006600; font-style: italic;">// Validate the data</span>
		<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000066;">name</span><span style="color: #339933;">==</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #errorName'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'This is a required field.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #name'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			isFocus<span style="color: #339933;">=</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
			isError<span style="color: #339933;">=</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>email<span style="color: #339933;">==</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #errorEmail'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'This is a required field.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>isFocus<span style="color: #339933;">==</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #email'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				isFocus<span style="color: #339933;">=</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			isError<span style="color: #339933;">=</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #003366; font-weight: bold;">var</span> reg <span style="color: #339933;">=</span> <span style="color: #009966; font-style: italic;">/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>reg.<span style="color: #660066;">test</span><span style="color: #009900;">&#40;</span>email<span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #errorEmail'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Invalid email address.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>isFocus<span style="color: #339933;">==</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #email'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					isFocus<span style="color: #339933;">=</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
				isError<span style="color: #339933;">=</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>message<span style="color: #339933;">==</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #errorMessage'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'This is a required field.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>isFocus<span style="color: #339933;">==</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #message'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				isFocus<span style="color: #339933;">=</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			isError<span style="color: #339933;">=</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #006600; font-style: italic;">// Terminate the script if an error is found</span>
		<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>isError<span style="color: #339933;">==</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #formProgress'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #formProgress'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #006600; font-style: italic;">// Activate the submit button</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #submit'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;disabled&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;&quot;</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: #660066;">ajaxSetup</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
			cache<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> dataString <span style="color: #339933;">=</span> <span style="color: #3366CC;">'name='</span><span style="color: #339933;">+</span> <span style="color: #000066;">name</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&amp;email='</span> <span style="color: #339933;">+</span> email <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&amp;subject='</span> <span style="color: #339933;">+</span> subject <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&amp;message='</span> <span style="color: #339933;">+</span> message<span style="color: #339933;">;</span>
		$.<span style="color: #660066;">ajax</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
			type<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;POST&quot;</span><span style="color: #339933;">,</span>
			url<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;php/submit-form-ajax.php&quot;</span><span style="color: #339933;">,</span>
			data<span style="color: #339933;">:</span> dataString<span style="color: #339933;">,</span>
			success<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>msg<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #006600; font-style: italic;">// Check to see if the mail was successfully sent</span>
				<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>msg<span style="color: #339933;">==</span><span style="color: #3366CC;">'Mail sent'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #006600; font-style: italic;">// Update the progress bar</span>
					$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #formProgress'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;img src=&quot;images/ajax-complete.gif&quot; /&gt; Message sent.'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">delay</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2000</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeOut</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">400</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #006600; font-style: italic;">// Clear the subject field and message textbox</span>
					$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #subject'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #message'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
					$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #formProgress'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'There was an error sending your email. Please try again.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
				<span style="color: #006600; font-style: italic;">// Activate the submit button</span>
				$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #submit'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;disabled&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
			error<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>ob<span style="color: #339933;">,</span>errStr<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #formProgress'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'There was an error sending your email. Please try again.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #006600; font-style: italic;">// Activate the submit button</span>
				$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #submit'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;disabled&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#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>OK, lets start with the first line of code, <em>$(document).ready(function() {</em>. This is jQuery&#8217;s handy little function to make sure that the rest of our script is run only once the document has loaded. So, basically, we want all our functions inside this jQuery function.</p>
<p>On the second line, <em>$(&#8216;#contactForm #submit&#8217;).click(function() {</em>, we are binding an event to the submit button which is referenced by its ID, <em>submit</em>. Inside this function we write the code that is to be executed once the form is submitted.</p>
<p>In the next three lines of code we are displaying a message to the user letting them know that the form is being processed. First we hide the progress bar with <em>$(&#8216;#contactForm #formProgress&#8217;).hide();</em>. Next we add our message to it with <em>$(&#8216;#contactForm #formProgress&#8217;).html(&#8216;&lt;img src=&#8221;images/ajax-loader.gif&#8221; /&gt; Sending…&#8217;);</em> and lastly we fade it in with <em>$(&#8216;#contactForm #formProgress&#8217;).fadeIn();</em>.</p>
<p>We want to disable the submit button whiles the form is being submitted just to make sure the user doesn&#8217;t submit it twice. The line <em>$(&#8216;#contactForm #submit&#8217;).attr(&#8220;disabled&#8221;, &#8220;disabled&#8221;);</em> takes care of that for us.</p>
<p>The next line, <em>$(&#8216;#contactForm .formError&#8217;).html(&#8221;);</em>, hides any previous error messages.</p>
<p>Now we&#8217;re ready to start validating the user&#8217;s inputs. So the first thing we&#8217;ll do is create two variables that we&#8217;ll use in the script for validation. The line <em>var isFocus=0;</em> creates and sets the value to &#8220;0&#8243; for the first of the two variables. We&#8217;ll use this variable to help us keep track of which input field to set focus on if there is a validation error. The next line, <em>var isError=0;</em>, creates the second variable we need. We&#8217;ll use this variable to see if there has been a validation error so we can stop the form from submitting and display the necessary errors.</p>
<p>To validate the user&#8217;s inputs we need to pull the data from the form so that&#8217;s what we do in the next four lines, get the user&#8217;s inputs and store them in variables. <em>var name=$(&#8216;#contactForm #name&#8217;).val();</em>, <em>var email=$(&#8216;#contactForm #email&#8217;).val();</em>, <em>var subject=$(&#8216;#contactForm #subject&#8217;).val();</em> and <em>var message=$(&#8216;#contactForm #message&#8217;).val();</em>.</p>
<p>Alright, it&#8217;s now time to validate our first field and that&#8217;s what we are doing in the following block of code&hellip;</p>

<div class="wp_syntax"><div 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: #000066;">name</span><span style="color: #339933;">==</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #errorName'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'This is a required field.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #name'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	isFocus<span style="color: #339933;">=</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
	isError<span style="color: #339933;">=</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>First we are checking if the user has left the &#8220;Name&#8221; field empty, <em>if(name==&#8221;) {</em>, since this is a required field that would result in a validation error. If the field is empty we display an error after the input field in the form with <em>$(&#8216;#contactForm #errorName&#8217;).html(&#8216;This is a required field.&#8217;);</em> and set the focus to that field with <em>$(&#8216;#contactForm #name&#8217;).focus();</em>. Since we have set focus to a field we update the value of the <em>isFocus</em> variable to &#8220;1&#8243;. Now we can check this variable when we validate the next field and only set focus to that field, if there is an error, if <em>isFocus</em> is &#8220;0&#8243; because if it&#8217;s &#8220;1&#8243; that would mean we have already set focus on a field and don&#8217;t want to change it. We also set <em>isError</em> to &#8220;1&#8243; if there is an error so we later can stop the script from submitting the form.</p>
<p>Next lets look at the code that will validate the &#8220;Email&#8221; field. This block of code is bigger than the previous one as we&#8217;ll also be checking to see if <em>isFocus</em> has been updated as well as if the user has entered a valid email address.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>email<span style="color: #339933;">==</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #errorEmail'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'This is a required field.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>isFocus<span style="color: #339933;">==</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #email'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		isFocus<span style="color: #339933;">=</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	isError<span style="color: #339933;">=</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> reg <span style="color: #339933;">=</span> <span style="color: #009966; font-style: italic;">/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>reg.<span style="color: #660066;">test</span><span style="color: #009900;">&#40;</span>email<span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #errorEmail'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Invalid email address.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>isFocus<span style="color: #339933;">==</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #email'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			isFocus<span style="color: #339933;">=</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		isError<span style="color: #339933;">=</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>So, the first line, <em>if(email==&#8221;) {</em>, checks if the &#8220;Email&#8221; field is empty and then if it is the second line, <em>$(&#8216;#contactForm #errorEmail&#8217;).html(&#8216;This is a required field.&#8217;);</em>, displays an error message after the input field in the form, same as we did with the &#8220;Name&#8221; field. If the &#8220;Email&#8221; field is empty we also check the value of <em>isFocus</em> on the next line, <em>if(isFocus==0) {</em>, and only change the focus to the &#8220;Email&#8221; field if its value is &#8220;0&#8243; with <em>$(&#8216;#contactForm #email&#8217;).focus();</em>. On the line after that, <em>isFocus=1;</em>, we set the value of <em>isFocus</em> to &#8220;1&#8243;. Next we update <em>isError</em> and set it to &#8220;1&#8243;.</p>
<p>So far we have checked if the &#8220;Email&#8221; field is empty and done the needful if it is. Now we need to validate the data in the &#8220;Email&#8221; field if it&#8217;s not empty and make sure it&#8217;s a valid email address. That is what we do in the <em>else</em> statement. First we create a variable called &#8220;reg&#8221; and store the regular expression in it, <em>var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;</em>. Next we test the value of the <em>email</em> variable against the regular expression in the <em>reg</em> variable, <em>if(reg.test(email)==false) {</em>, and display an error if it&#8217;s not a match, <em>$(&#8216;#contactForm #errorEmail&#8217;).html(&#8216;Invalid email address.&#8217;);</em>. Then we do the same check for focus as earlier and set <em>isError</em> to &#8220;1&#8243;.</p>
<p>The last field we need to validate is the &#8220;Message&#8221; text box. So we check if it is empty with <em>if(message==&#8221;) {</em> and display an error message with <em>$(&#8216;#contactForm #errorMessage&#8217;).html(&#8216;This is a required field.&#8217;);</em> if it is. Then we do the check for <em>isFocus</em> and update <em>isError</em> just like we did for the previous two fields.</p>
<p>Now we are done checking and validating all the required input fields of the form.</p>
<p>The next step is to determine whether there have been any validation errors. We&#8217;ll use our handy <em>isError</em> variable to do this check. We know that we have an error if the value of <em>isError</em> is &#8220;1&#8243; so we&#8217;ll check that in an <em>if</em> statement and stop the script from submitting the form if that is the case. Lets have a look at the code we are using for this&hellip;</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>isError<span style="color: #339933;">==</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #formProgress'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #formProgress'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #submit'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;disabled&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;&quot;</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></pre></div></div>

<p>So, our <em>if</em> statement checks if <em>isError</em> is &#8220;1&#8243;, <em>if(isError==1) {</em>, and if it is it will clear and hide the progress bar, which so far has been displaying the message &#8220;Sending&hellip;&#8221;, with the lines <em>$(&#8216;#contactForm #formProgress&#8217;).html(&#8221;);</em> and <em>$(&#8216;#contactForm #formProgress&#8217;).hide();</em>. Then we activate the submit button with <em>$(&#8216;#contactForm #submit&#8217;).attr(&#8220;disabled&#8221;, &#8220;&#8221;);</em> and finally we stop the script from continuing with <em>return false;</em>.</p>
<p>Alright, so we have now validated all the fields and stopped the script if there are any errors. Next step is to submit the form with AJAX if there aren&#8217;t any errors, so lets get to it.</p>
<p>One thing I like to do is use jQuery&#8217;s <em>$.ajaxSetup</em> function to set default settings for AJAX calls. In this function we&#8217;ll set &#8220;cache&#8221; to &#8220;false&#8221; which will force the pages that we request to not be cached by the browser.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">ajaxSetup</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
	cache<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>That&#8217;s it, now all future AJAX calls will have this setting. Below is our AJAX call to submit the form.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> dataString <span style="color: #339933;">=</span> <span style="color: #3366CC;">'name='</span><span style="color: #339933;">+</span> <span style="color: #000066;">name</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&amp;email='</span> <span style="color: #339933;">+</span> email <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&amp;subject='</span> <span style="color: #339933;">+</span> subject <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&amp;message='</span> <span style="color: #339933;">+</span> message<span style="color: #339933;">;</span>
$.<span style="color: #660066;">ajax</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
	type<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;POST&quot;</span><span style="color: #339933;">,</span>
	url<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;php/submit-form-ajax.php&quot;</span><span style="color: #339933;">,</span>
	data<span style="color: #339933;">:</span> dataString<span style="color: #339933;">,</span>
	success<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>msg<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>msg<span style="color: #339933;">==</span><span style="color: #3366CC;">'Mail sent'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #formProgress'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;img src=&quot;images/ajax-complete.gif&quot; /&gt; Message sent.'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">delay</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2000</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeOut</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">400</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #subject'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #message'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #formProgress'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'There was an error sending your email. Please try again.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #submit'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;disabled&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
	error<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>ob<span style="color: #339933;">,</span>errStr<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #formProgress'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'There was an error sending your email. Please try again.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#contactForm #submit'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;disabled&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>First we&#8217;re creating a variable called <em>dataString</em> in which we are storing our parameters. We&#8217;ll use this soon in our AJAX call. Once our parameters are setup we use jQuery&#8217;s <em>$.ajax</em> function to make our AJAX request. Inside this function we set the request method to &#8220;post&#8221; with <em>type: &#8220;POST&#8221;</em> and the URL we want to request with <em>url: &#8220;php/submit-form-ajax.php&#8221;</em>. Next we pass our parameters with <em>data: dataString</em> where <em>dataString</em> is the variable we created earlier.</p>
<p>The next setting is <em>success</em> in which we create a function telling jQuery what to do if the request is successful. The function gets an argument passed back which is the data returned from the script we called. In the function we check if the data returned is the string &#8220;Mail sent&#8221; with <em>if(msg==&#8217;Mail sent&#8217;) {</em> and if it is we update the progress bar to display the message &#8220;Message sent.&#8221; with the line <em>$(&#8216;#contactForm #formProgress&#8217;).html(&#8216;&lt;img src=&#8221;images/ajax-complete.gif&#8221; /&gt; Message sent.&#8217;).delay(2000).fadeOut(400);</em>. The message stays on the screen for two seconds and then fades out, <em>delay(2000)</em> &#8220;pauses&#8221; the script for 2 seconds and <em>fadeOut(400)</em> fades out the message in 400 milliseconds. We also clear out the &#8220;Subject&#8221; text field and the &#8220;Message&#8221; text box in the form, so the user can&#8217;t send a second message with the same values, with the lines <em>$(&#8216;#contactForm #subject&#8217;).val(&#8221;);</em> and <em>$(&#8216;#contactForm #message&#8217;).val(&#8221;);</em>.</p>
<p>If the data returned is not &#8220;Mail sent&#8221; that would mean we had an error. If that is the case we clear the progress bar with <em>$(&#8216;#contactForm #formProgress&#8217;).html(&#8221;);</em>, and show the user an error, <em>alert(&#8216;There was an error sending your email. Please try again.&#8217;);</em>.</p>
<p>The next line, <em>$(&#8216;#contactForm #submit&#8217;).attr(&#8220;disabled&#8221;, &#8220;&#8221;);</em>, enables the submit button again.</p>
<p>The last setting we need for the AJAX call is <em>error</em>. Here we create a function that tells jQuery what to do if the AJAX request wasn&#8217;t successful. We&#8217;ll do the exact same thing as above, clear the progress bar, display an error message to the user and then enable the submit button.</p>
<p>The last line of code that we need is <em>return false;</em> which stops our form from being submitted the traditional way.</p>
<h3>The End</h3>
<p>That&#8217;s it, we&#8217;re done. I hope you enjoyed this tutorial and learned a trick or two. If you&#8217;re unclear about anything you can leave a comment below and I&#8217;ll do my best to explain.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.faridhadi.com/submitting-a-form-without-reloading-the-page-using-jquery-and-ajax/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
		</item>
		<item>
		<title>Slide your contact form in with style… using jQuery</title>
		<link>http://www.faridhadi.com/slide-your-contact-form-in-with-style-using-jquery/</link>
		<comments>http://www.faridhadi.com/slide-your-contact-form-in-with-style-using-jquery/#comments</comments>
		<pubDate>Wed, 20 May 2009 09:54:24 +0000</pubDate>
		<dc:creator>Farid Hadi</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.faridhadi.com/?p=36</guid>
		<description><![CDATA[It&#8217;s been a while since I wrote a tutorial and since I&#8217;m waiting for a couple of clients to get back to me I figured I might as well take this opportunity to do so. In this very simple tutorial I’ll show you how to use jQuery to create a nice effect that you can [...]]]></description>
			<content:encoded><![CDATA[<p><small></small><br />
<img src="/images/slide-your-contact-form-in-with-style/slide-your-contact-form-in-with-style.jpg" alt="Slide your contact form in with style… using jQuery" /><br />
It&#8217;s been a while since I wrote a tutorial and since I&#8217;m waiting for a couple of clients to get back to me I figured I might as well take this opportunity to do so.</p>
<p>In this very simple tutorial I’ll show you how to use jQuery to create a nice effect that you can use to slide in your contact form, for example, from above the page.<br />
<span id="more-36"></span><br />
You can <a href="http://www.faridhadi.com/demo/slide-your-contact-form-in-with-style/" title="check out the demo">check out the demo here</a> before we start so you know what we’re going to be doing.</p>
<p>You can also <a href="http://www.faridhadi.com/zip/slide-your-contact-form-in-with-style.zip" title="download a zip file">download a zip file</a> containing all the files used in this tutorial.</p>
<p>Alright, let’s start by getting jQuery, if you don’t already have it. Go to <a href="http://www.jquery.com" title="jQuery Home Page">www.jquery.com</a> and grab the latest version of the library.</p>
<p>Now create your HTML document and add a div for the contact form. I’m giving it an id of “panel”, you can name it whatever you want but we’ll need an id so we can access it. Here is how my markup looks.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;panel&quot;</span>&gt;</span>
	[INSERT YOUR CONTACT FORM HERE]
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>Keep this div on top of all your other markup, just below your body tag.<br />
I’ve just written “[INSERT YOUR CONTACT FORM HERE]” but this is obviously where you need to enter your markup for the contact form.</p>
<p>Great, now that you have your contact form ready we’ll soon be hiding it with display:none so that it’s hidden when the page loads. But before starting with the CSS let’s add a link that the users can click to slide the form in and out. Just like with the div we’re using as a container for the contact form, we’ll need an id on this link too. I’m also adding a class to the link so that I can change the class on the fly, when the form is out. Here is the markup I have used.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;contact&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;contact-toggle&quot;</span>&gt;</span>Contact<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span></pre></div></div>

<p>I’m just placing the link below the contact form div, I’ll be floating it to the right once we start with our CSS, but you can place it wherever you want to, e.g. in you navigation.</p>
<p>This is all the markup I’m going to be using for this example. Here is the complete document, excluding doctype etc.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;</span>jQuery Slide Contact Form<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;panel&quot;</span>&gt;</span>
	[INSERT YOUR CONTACT FORM HERE]
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;contact&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;contact-toggle&quot;</span>&gt;</span>Contact<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre></div></div>

<p>Now let’s start with the CSS. I have created a stylesheet, named it “style.css” and saved it in a folder called “css” in the same folder as I have saved the HTML document above, I’ll be calling this folder the root folder from now. So, now I can link the stylesheet to the HTML document like below.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;css/style.css&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>

<p>The first thing I have done, as I usually do, is get rid of the margins and paddings of the body element. I have also changed the font to 12px Verdana as I prefer it to the browsers’ default choice of font.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">body {
	margin:0px;
	padding:0px;
	font:12px Verdana;
}</pre></div></div>

<p>Next in my stylesheet are the styles for the contact form container div. The one we gave an id of “panel”.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">#panel {
	height:500px;
	background-color:#322626;
	color:#fff;
	display:none;
}</pre></div></div>

<p>I gave my div a height of 500px. You can assign whatever value you require to fit your contact form here. I’ve also given it a background-color and a color. These values would obviously change according to your design, these are just the values I chose to use. The last line is an important one, setting display:none ensures that the contact form is hidden when the page loads.</p>
<p>Now I styled my link to look a little better than blue, underlined text.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">.contact {
	float:right;
	width:150px;
	height:40px;
	margin-right:50px;
	text-indent:-9999px;
	background:#322626 url(../images/contact-sprite.gif) 0px -40px no-repeat;
}</pre></div></div>

<p>Most of this class is pretty self-explained.<br />
Setting the “text-indent” to -9999px will place the link text way off the viewport, so we won’t see it but it’s still there incase CSS is turned off and also for accessibility purposes.<br />
For the background I’m using a technique called CSS Sprites. If the background style isn’t making sense to you, you can read my <a href="http://www.faridhadi.com/css-sprites-what-why-how/" title="CSS Sprites: What, why and how">tutorial on CSS Sprites</a>.</p>
<p>You can <a href="http://www.faridhadi.com/demo/slide-your-contact-form-in-with-style/images/contact-sprite.gif" title="grab the sprite image I created here">grab the sprite image I created here</a> if you want to use the same one whiles following. Save this image in a folder called “images” in your root folder.</p>
<p>We’re using sprites because our link has a hover and “active” state. The hover state is simply handled by CSS like this.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">.contact:hover {
	background:#322626 url(../images/contact-sprite.gif) 0px 0px no-repeat;
}</pre></div></div>

<p>Now for the “active” state, which will be used when the contact form is out, we’ll use jQuery to change the CSS class on the link. Here is the CSS for it, we’ll get to the jQuery bit in just a moment.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">.contact-active {
	background:#322626 url(../images/contact-sprite.gif) 0px -120px no-repeat;
}
.contact-active:hover {
	background:#322626 url(../images/contact-sprite.gif) 0px -80px no-repeat;
}</pre></div></div>

<p>That’s all the CSS I’m using for this example, here is the complete CSS document I’m using.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">body {
	margin:0px;
	padding:0px;
	font:12px Verdana;
}
#panel {
	height:500px;
	background-color:#322626;
	color:#fff;
	display:none;
}
.contact {
	float:right;
	width:150px;
	height:40px;
	margin-right:50px;
	text-indent:-9999px;
	background:#322626 url(../images/contact-sprite.gif) 0px -40px no-repeat;
}
.contact:hover {
	background:#322626 url(../images/contact-sprite.gif) 0px 0px no-repeat;
}
.contact-active {
	background:#322626 url(../images/contact-sprite.gif) 0px -120px no-repeat;
}
.contact-active:hover {
	background:#322626 url(../images/contact-sprite.gif) 0px -80px no-repeat;
}</pre></div></div>

<p>Now let’s get to the fun part. First make a copy of the jQuery file you downloaded and place it in a folder called “js” in your root directory. Rename your jQuery file to “jquery.js”.</p>
<p>Link the jQuery script to your HTML document like this.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;js/jquery.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre></div></div>

<p>And below that we add our magical code to handle to slide effect.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span>
$(document).ready(function(){
	$(&quot;.contact&quot;).click(function(){
		$(&quot;#panel&quot;).slideToggle(&quot;slow&quot;);
		$(this).toggleClass(&quot;contact-active&quot;);
		return false;
	});
});
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre></div></div>

<p>That’s it. Were you expecting this to be complicated?</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">$(&quot;.contact&quot;).click(function(){
	. . .
});</pre></div></div>

<p>This means that when the element with id contact-toggle, our link, is clicked we want to run some code.</p>
<p>The code we want to run is&hellip;</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">$(&quot;#panel&quot;).slideToggle(&quot;slow&quot;);</pre></div></div>

<p>&hellip;which will make our div slide in/out.</p>
<p>I’ve also added the line&hellip;</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">$(this).toggleClass(&quot;contact-active&quot;);</pre></div></div>

<p>&hellip;which changes the class of our link. This is so our link can look different when the form is out.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">return false;</pre></div></div>

<p>This just makes sure our link doesn’t try to load a page.</p>
<p>That’s it. That’s all there is to it. So, basically, all you need to do is create a form, wrap it in a div. Give the div a height and set its display to none. Load in jQuery and add those 7 lines of jQuery code.</p>
<p>I hope you enjoyed this tutorial!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.faridhadi.com/slide-your-contact-form-in-with-style-using-jquery/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>5 really useful WordPress plugins</title>
		<link>http://www.faridhadi.com/5-really-useful-wordpress-plugins/</link>
		<comments>http://www.faridhadi.com/5-really-useful-wordpress-plugins/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 16:03:49 +0000</pubDate>
		<dc:creator>Farid Hadi</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.faridhadi.com/?p=32</guid>
		<description><![CDATA[Luckily, I chose to use WordPress when I started blogging and today I&#8217;m pretty glad about it considering all the plugins available for it. I&#8217;ve spent the past few days wondering how I could improve my blog, it really needs to be improved, and blogging experience and have in my quest read loads of articles [...]]]></description>
			<content:encoded><![CDATA[<p><small></small><br />
<img src="/images/5-really-useful-wordpress-plugins/5-really-useful-wordpress-plugins.jpg" alt="5 really useful WordPress plugins" /><br />
Luckily, I chose to use WordPress when I started blogging and today I&#8217;m pretty glad about it considering all the plugins available for it.<br />
I&#8217;ve spent the past few days wondering how I could improve my blog, it really needs to be improved, and blogging experience and have in my quest read loads of articles and checked out quite a few WordPress plugins.</p>
<p>For this post I have shortlisted 5 plugins that I feel are really useful and should be installed on every blog.<br />
<span id="more-32"></span><br />
I&#8217;m not trying to say that these are the only useful plugins, I&#8217;m sure you&#8217;ll find a lot more out there but these are the ones I came across and really liked.</p>
<p>Without further ado I present you with my list of 5 really useful WordPress plugins!</p>
<p>These first two are time savers. They&#8217;ll automatically do two things that you should always do after publishing a post.</p>
<h3><a href="http://wordpress.org/extend/plugins/google-sitemap-generator/" title="Google XML Sitemaps WordPress plugin">Google XML Sitemaps</a></h3>
<p>This WordPress plugin will create and update an XML Sitemap for your blog everytime you publish or update a post.<br />
It will also notify all major search engines every time there is a change in your Sitemap.<br />
If you don&#8217;t know about XML Sitemaps you really should take a minute to read about it. <a href="http://www.google.com/support/webmasters/bin/answer.py?answer=40318&#038;hl=en" title="About Sitemaps">You can read about XML Sitemaps here</a>.</p>
<p>After publishing a post I also tweet about it on Twitter to let the handful of followers I have know that I have put up some new content, and that brings us to the next item in my list.</p>
<h3><a href="http://wordpress.org/extend/plugins/feed2tweet/" title="Feed2tweet WordPress plugin">Feed2tweet</a></h3>
<p>This is a really simple plugin that will automatically tweet your new WordPress posts to your Twitter account.<br />
You can customize your tweet messages and it supports multiple URL shortening services (tinyurl, is.gd, bit.ly).<br />
There are other plugins that do this but I chose this one because of it&#8217;s simplicity, this is all it does.</p>
<p>With these two plugins under the hood, I save at least 10 minutes per post! <img src='http://www.faridhadi.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Most importantly, the process has been automated so I can forget about it and focus on other things.</p>
<p>The next item on my list will slightly improve your blogs usability.<br />
The pagination on most WordPress blogs are just&hellip; well&hellip; no good and that&#8217;s why I suggest using this next plugin.</p>
<h3><a href="http://wordpress.org/extend/plugins/wp-pagenavi/" title="WP-PageNavi WordPress plugin">WP-PageNavi</a></h3>
<p>This little plugin adds a more advanced paging navigation to your WordPress blog.<br />
You&#8217;ll need to make a slight change to your template, add a line of code, but it&#8217;s totally worth it.</p>
<p>The next 2 plugins are meant to increase interactivity on your blog.<br />
I personally feel that the first one of these two is more a must have than just a useful plugin, but that&#8217;s just my opinion.</p>
<h3><a href="http://wordpress.org/extend/plugins/subscribe-to-comments/" title="Subscribe to Comments WordPress plugin">Subscribe to Comments</a></h3>
<p>This WordPress plugin enables commenters to sign up for e-mail notification of subsequent comments on a post.<br />
It also allows them to unsubscribe from future notifications so don&#8217;t worry about that.<br />
With this plugin it will be easier to start a conversation in your post comments and I definitely think you should install this one.</p>
<h3><a href="http://wordpress.org/extend/plugins/wp-greet-box/" title="WP Greet Box WordPress plugin">WP Greet Box</a></h3>
<p>This plugin lets you show your visitors a different greeting message depending on their referrer URL.<br />
Greeting messages automatically get inserted into the top of your posts and you can, for example, suggest your new visitors to subscribe to your RSS feed.<br />
You can also set a timeout to forget a visitor so you do not keep nagging your visitors with greeting messages.</p>
<p>That&#8217;s it! That&#8217;s my list of really useful WordPress plugins. What did you think of it? Do you know of any other plugins that you think are useful?<br />
Leave a comment and let me know what your thoughts.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.faridhadi.com/5-really-useful-wordpress-plugins/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>10 useful links for web designers and developers</title>
		<link>http://www.faridhadi.com/10-useful-links-for-web-designers-and-developers/</link>
		<comments>http://www.faridhadi.com/10-useful-links-for-web-designers-and-developers/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 18:49:11 +0000</pubDate>
		<dc:creator>Farid Hadi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.faridhadi.com/?p=31</guid>
		<description><![CDATA[Below you&#8217;ll find links to articles and resources for designers and developers. I hope you find this useful and that I introduce you to something new. Groject ImageSwitch jQuery plug-in This jQuery plug-in will let you use neat effect, such as fade in, scroll in, flip in etc., for switching between images. s3Slider jQuery plugin [...]]]></description>
			<content:encoded><![CDATA[<p><small></small><br />
<img src="/images/10-useful-links-for-web-designers-and-developers/10-useful-links-for-web-designers-and-developers.jpg" alt="10 useful links for web designers and developers" /><br />
Below you&#8217;ll find links to articles and resources for designers and developers.<br />
I hope you find this useful and that I introduce you to something new.<br />
<span id="more-31"></span></p>
<h3><a href="http://www.hieu.co.uk/ImageSwitch/" title="Groject ImageSwitch jQuery plug-in">Groject ImageSwitch jQuery plug-in</a></h3>
<p>This jQuery plug-in will let you use neat effect, such as fade in, scroll in, flip in etc., for switching between images.</p>
<h3><a href="http://www.serie3.info/s3slider/index.php" title="s3Slider jQuery plugin">s3Slider jQuery plugin</a></h3>
<p>This jQuery plug-in is used for creating a smooth slideshow.<br />
Check out the demonstration page to see some really good looking examples.</p>
<h3><a href="http://www.webresourcesdepot.com/how-to-add-tweeting-with-short-url-functionality-to-a-website-with-php/" title="How To Add Tweeting With Short URL Functionality To A Website (With PHP)">How To Add Tweeting With Short URL Functionality To A Website (With PHP)</a></h3>
<p>This is a great way to help the readers of a website share/tweet a content at Twitter easily.</p>
<h3><a href="http://goodplum.com/2009/02/09/get-a-following-on-twitter-by-giving/" title="Get a Following on Twitter by Giving">Get a Following on Twitter by Giving</a></h3>
<p>&#8220;&hellip; By providing value to your followers, you’ll receive mentions on other people’s posts &#8211; which in turn, build your followers naturally. &hellip;&#8221;</p>
<h3><a href="http://wordpress.org/extend/plugins/wp-super-cache/" title="WP Super Cache">WP Super Cache</a></h3>
<p>Here is a WordPress plug-in that should help your server cope with a front page appearance on Digg.com or other social networking site.</p>
<h3><a href="http://www.noupe.com/php/10-ways-to-automatically-manually-backup-mysql-database.html" title="10 Ways to Automatically &#038; Manually Backup MySQL Database">10 Ways to Automatically &#038; Manually Backup MySQL Database</a></h3>
<p>It&#8217;s important to backup your data. This article should point you in the right direction of doing just that.</p>
<h3><a href="http://webrecron.co.cc/index.php" title="ReCron - Free Online Web Cron Service">ReCron &#8211; Free Online Web Cron Service</a></h3>
<p>Many of us don&#8217;t have access to setting up cron jobs. This is a pretty good solution, the best free one that I&#8217;ve come across so far.</p>
<h3><a href="http://todoist.com/" title="Todoist - a task manager that's useful, fast and easy to use">Todoist &#8211; a task manager that&#8217;s useful, fast and easy to use</a></h3>
<p>Todoist is the best way to stay organized, that&#8217;s what they themselves claim.<br />
I&#8217;ve been using this app everyday for the past few months and I thinks it&#8217;s great.</p>
<h3><a href="http://www.sitepoint.com/blogs/2009/03/11/what-it-means-to-copyright-a-website/" title="What It Means to Copyright a Website">What It Means to Copyright a Website</a></h3>
<p>What exactly does it mean to copyright a website and what protection does it provide?</p>
<h3><a href="http://www.37signals.com/svn/posts/1619-theres-always-time-to-launch-your-dream" title="There's always time to launch your dream">There&#8217;s always time to launch your dream</a></h3>
<p>This is a must read for anyone who dreams of being an entrepreneur but just can&#8217;t seem to get things rolling.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.faridhadi.com/10-useful-links-for-web-designers-and-developers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>11 free icon sets</title>
		<link>http://www.faridhadi.com/11-free-icon-sets/</link>
		<comments>http://www.faridhadi.com/11-free-icon-sets/#comments</comments>
		<pubDate>Fri, 13 Mar 2009 10:49:31 +0000</pubDate>
		<dc:creator>Farid Hadi</dc:creator>
				<category><![CDATA[Design]]></category>

		<guid isPermaLink="false">http://www.faridhadi.com/?p=30</guid>
		<description><![CDATA[I have been surfing around and downloading free icon sets these past couple of days and I thought I would share them with you. Below is a list of icon sets that I liked and links to where you can go get them for yourself. Be sure to check the licenses before using any of [...]]]></description>
			<content:encoded><![CDATA[<p><small></small><br />
<img src="/images/11-free-icon-sets/11-free-icon-sets.jpg" alt="11 Free Icon Sets" /><br />
I have been surfing around and downloading free icon sets these past couple of days and I thought I would share them with you.<br />
Below is a list of icon sets that I liked and links to where you can go get them for yourself.<br />
<span id="more-30"></span><br />
Be sure to check the licenses before using any of the icons in your projects!</p>
<h3><a href="http://wefunction.com/2008/07/function-free-icon-set/" title="Free Icons: Function Icon Set, 128 Completely Free Icons">Free Icons: Function Icon Set, 128 Completely Free Icons</a></h3>
<p><img src="/images/11-free-icon-sets/function-icon-set.jpg" alt="Function Icon Set" /><br />
The Function Icon Set consists of 128 glossy 48×48px icons in .png format.<br />
The set contains icons for some of the main Social Media Icons, arrows, boxes, coffee cups, speech bubbles, cameras, credit cards, mail, database, image and more.<br />
These icons are free and can be used in any project.</p>
<h3><a href="http://www.tutorial9.net/resources/free-icon-pack-bevel-dark-social-icons/" title="Free Icon Pack: Bevel Dark Social Icons">Free Icon Pack: Bevel Dark Social Icons</a></h3>
<p><img src="/images/11-free-icon-sets/bevel-dark-icon-set.jpg" alt="Bevel Dark Social Icons" /><br />
This icon pack includes 10 icons featuring the logos of popular social bookmarking sites; BlinkList, Del.icio.us, Design Float, Digg, Dzone, Flurl, Mixx, Reddit, Stumble Upon and Technorati.<br />
All these icons are available in 32x32px, 48x48px, and 64x64px and are in .png format.<br />
This icon pack can be used in personal and commercial projects.</p>
<h3><a href="http://www.tutorial9.net/resources/free-social-icon-pack-bevel-lite/" title="Free Social Icon Pack: Bevel Lite">Free Social Icon Pack: Bevel Lite</a></h3>
<p><img src="/images/11-free-icon-sets/bevel-lite-icon-set.jpg" alt="Bevel Lite" /><br />
This icon pack includes 10 icons featuring the logos of popular social bookmarking sites; BlinkList, Del.icio.us, Design Float, Digg, Dzone, Flurl, Mixx, Reddit, Stumble Upon and Technorati.<br />
All these icons are available in 32x32px, 48x48px, and 64x64px and are in .png format.<br />
This icon pack can be used in personal and commercial projects.</p>
<h3><a href="http://www.smashingmagazine.com/2009/01/23/friday-freebies-flavours-icon-set-and-cute-tweeters-icon-set/" title="Flavours Icon Set And Cute Tweeters Icon Set (2 different icon sets)">Flavours Icon Set And Cute Tweeters Icon Set (2 different icon sets)</a></h3>
<p><img src="/images/11-free-icon-sets/flavour-icon-set.jpg" alt="Flavours Icon Set" /><br />
The Flavour Icon Set consists of 177 48×48px icons in .png format.<br />
The set includes buttons and icons for RSS, screens, charts, mail, boxes, documents and more.<br />
You can freely use this set for both your private and commercial projects.</p>
<p><img src="/images/11-free-icon-sets/cute-tweeters-icon-set.jpg" alt="Cute Tweeters Icon Set" /><br />
This Twitter Icon set includes 8 different icons in 128×128 pixels, 256×256 and 512×512 and are in .png format.<br />
You can freely use this set for both your private and commercial projects.</p>
<h3><a href="http://www.freeiconsweb.com/Free_web_development_icons.html" title="Free web development icons">Free web development icons</a></h3>
<p><img src="/images/11-free-icon-sets/free-web-development-icon-set.jpg" alt="Free web development icons" /><br />
This set contains 26 16x16px colored and grey icons in .bmp, .gif, .icns, .ico, .png and .tif format.</p>
<h3><a href="http://www.freeiconsweb.com/free_button_icons.html" title="70 Free Button Icons">70 Free Button Icons</a></h3>
<p><img src="/images/11-free-icon-sets/free-button-icon-set.jpg" alt="70 Free Button Icons" /><br />
This set includes 71 buttons in blue, green, grey, pink and yellow.<br />
These icons are free for personal,non-commercial use.</p>
<h3><a href="http://www.freeiconsweb.com/Free_web_rss_icons.html" title="Free web 2.0 RSS icons">Free web 2.0 RSS icons</a></h3>
<p><img src="/images/11-free-icon-sets/rss-icon-set.jpg" alt="Free web 2.0 RSS icons" /><br />
This set consists of some really nice looking RSS icons.<br />
These are available in 16x16px and 32x32px and in .icns, .ico, .png, .tif and .psd format.</p>
<h3><a href="http://www.freeiconsweb.com/PI_Diagona_Pack.html" title="PI Diagona Icons Pack">PI Diagona Icons Pack</a></h3>
<p><img src="/images/11-free-icon-sets/pi-diagona-icon-set.jpg" alt="PI Diagona Icons Pack" /><br />
The PI Diagona Icon Pack contains 200 10x10px and 16x16px icons all in .png format.<br />
You should find anything you need for your web application in this pack.</p>
<h3><a href="http://www.freeiconsweb.com/free_small_icons.html" title="90 Free Small Icons">90 Free Small Icons</a></h3>
<p><img src="/images/11-free-icon-sets/90-small-icon-set.jpg" alt="90 Free Small Icons" /><br />
This pack contains 92 16x16px icons in .png format suitable for web applications.</p>
<h3><a href="http://www.freeiconsweb.com/Free_eCommerce_icons.html" title="Free eCommerce icons">Free eCommerce icons</a></h3>
<p><img src="/images/11-free-icon-sets/glossy-ecommerce-icon-set.jpg" alt="Free eCommerce icons" /><br />
This is an amazing icon set for eCommerce projects. It contains 32 glossy 32x32px icons.<br />
This icon set is released under the GNU Lesser General Public License (LGPL).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.faridhadi.com/11-free-icon-sets/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Great offer by SitePoint</title>
		<link>http://www.faridhadi.com/great-offer-by-sitepoint/</link>
		<comments>http://www.faridhadi.com/great-offer-by-sitepoint/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 19:54:57 +0000</pubDate>
		<dc:creator>Farid Hadi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.faridhadi.com/?p=28</guid>
		<description><![CDATA[In an effort to raise funds to help the thousands of victims of the Australian bushfire, SitePoint has an incredible offer letting you buy 5 books (worth $149.75) for just $29.95. 100% of the proceeds from this sale will be donated to the Australian Red Cross Victorian Bushfire Appeal. This offer is only valid till [...]]]></description>
			<content:encoded><![CDATA[<p>In an effort to raise funds to help the thousands of victims of the Australian bushfire, SitePoint has an incredible offer letting you buy 5 books (worth $149.75) for just $29.95.<br />
<strong>100% of the proceeds from this sale will be donated to the <a href="http://www.redcross.org.au/vic/services_emergencyservices_victorian-bushfires-appeal-2009.htm" title="Australian Red Cross Victorian Bushfire Appeal">Australian Red Cross Victorian Bushfire Appeal</a>.</strong><br />
This offer is only valid till Friday 13th Feb 2009, so if you are thinking about getting your hands on some good web design/development books this is a great opportunity for you to get 5 books for the price of 1 and do a good deed at the same time.</p>
<p><strong><a href="http://5for1.aws.sitepoint.com/" title="The SitePoint 5-for-1 Sale">Get over to SitePoint and check out their great 5-for-1 Sale!</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.faridhadi.com/great-offer-by-sitepoint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to hide your email address from spam bots</title>
		<link>http://www.faridhadi.com/how-to-hide-your-email-address-from-spam-bots/</link>
		<comments>http://www.faridhadi.com/how-to-hide-your-email-address-from-spam-bots/#comments</comments>
		<pubDate>Sat, 03 Jan 2009 09:55:45 +0000</pubDate>
		<dc:creator>Farid Hadi</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.faridhadi.com/?p=26</guid>
		<description><![CDATA[I personally feel that a good contact page should display your email address, even if you are using a contact form, and I&#8217;m sure a lot of you out there agree with me on this. Having said that, here is a simple way to display your email address in a safe, or at least safer, [...]]]></description>
			<content:encoded><![CDATA[<p><small></small><br />
<img src="/images/hiding-email-address/bad-spam-bot.jpg" alt="Bad Spam Bot!" /><br />
I personally feel that a good contact page should display your email address, even if you are using a contact form, and I&#8217;m sure a lot of you out there agree with me on this. Having said that, here is a simple way to display your email address in a safe, or at least safer, way hiding it from evil spam bots but displaying it to your visitors with the use of JavaScript.<br />
<span id="more-26"></span><br />
A spam bot will check your source code looking for email addresses. We just need to make sure there aren&#8217;t any there for it to steal. Now you could choose not to type out your email address at all in your source code or you could type out something that is readable by humans but doesn&#8217;t look like an email address to the bots. Keep in mind that if you don&#8217;t type out anything in your source code visitors with JavaScript turned off (although a very tiny percentage) or screen readers won&#8217;t have access to your email address, and this is neither good usability or accessibility. This is why it&#8217;s better to type out something that makes sense to humans but not the spam bots, even though it would be safer not to.</p>
<p>It&#8217;s become quite common to replace &#8220;@&#8221; with &#8221; [at] &#8221; and &#8220;.&#8221; with &#8221; [dot] &#8221; when typing out your email address on the net. This way I can type out my email address like farid [at] faridhadi [dot] com which is readable to humans but doesn&#8217;t look like an email address to the bots.</p>
<p>You could just wrap that up in a mailto link and be done with it but that would just mean that you are letting the bad guys win, so don&#8217;t! It&#8217;s bad usability! Your precious visitors will have to manually replace &#8221; [at] &#8221; with &#8220;@&#8221; and &#8221; [dot] &#8221; with &#8220;.&#8221;. Instead, lets use some good JavaScript and make it a nice, user-friendly link, not letting your visitors experience any inconvenience and letting them comfortably send you an email.</p>
<p><img src="/images/hiding-email-address/good-javascript.jpg" alt="Good JavaScript!" /><br />
If you have a look at my &#8220;<a href="/contact-me/" title="Contact Me">Contact Me</a>&#8221; page you&#8217;ll see the line &#8220;Use the form below to get in touch with me or send me an email at [my email address]&#8221; where [my email address] is a fully functional mailto link. Now, if you have a look at the source code of the same page you&#8217;ll see &#8220;Use the form below to get in touch with me or send me an email at &lt;span id=&#8221;hidden&#8221;&gt;farid [at] faridhadi [dot] com&lt;/span&gt;&#8221;. This replacement is done with JavaScript, and since it is, the source code will be left as it is. This means the spam bots will see farid [at] faridhadi [dot] com, and hopefully not recognize it as an email address, whiles my visitors will see my email address as a nice little mailto link.</p>
<p><strong>Let me show you how it&#8217;s done!</strong><br />
The markup for this is simple, as I&#8217;ve already shown you above.</p>
<p><code><br />
Use the form below to get in touch with me or send me an email at &lt;span id="hidden"&gt;farid [at] faridhadi [dot] com&lt;/span&gt;<br />
</code><br />
Now all we need to do is get the element with ID &#8220;hidden&#8221; and replace it&#8217;s contents with my email address in a mailto link. Here is the JavaScript I wrote to take care of that, making sure not to type out the email address in its full form by creating a variable and adding the markup to it bit by bit. This way the bots should not be able to figure out that it&#8217;s an email address.</p>
<p><code><br />
&lt;script type="text/javascript"&gt;<br />
var str='&lt;a ';<br />
str+='href';<br />
str+='="mailto';<br />
str+=':farid';<br />
str+='@';<br />
str+='farid';<br />
str+='hadi.';<br />
str+='c';<br />
str+='o';<br />
str+='m"';<br />
str+='&gt;farid';<br />
str+='@';<br />
str+='farid';<br />
str+='hadi.';<br />
str+='c';<br />
str+='o';<br />
str+='m&lt;';<br />
str+='/a';<br />
str+='&gt;';<br />
document.getElementById('hidden').innerHTML=str;<br />
&lt;/script&gt;<br />
</code><br />
As you can see, the function is very simple and straight forward. This technique works fine if you need to protect a single or just a few email address that you know, like in the case of a contact page. You can easily add more addresses by adding multiple spans in your markup with an id that increases for every address like hidden-1, hidden-2 and so on and updating the JavaScript to replace them as your situation requires.</p>
<p><strong>Does this technique have any weaknesses?</strong><br />
According to me, the only weakness is the fact that we are typing out the email address as foo [at] bar [dot] com and since it&#8217;s become quite common to do so the bad guys will probably, if they haven&#8217;t already, teach their evil bots to recognize that as an email address.</p>
<p>I&#8217;ll let you know if I start getting spammed after this post =)</p>
<p><strong>What are your thoughts on this?</strong> Do you use another technique to display your email address? Do you try to protect it at all? Share your thoughts with us in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.faridhadi.com/how-to-hide-your-email-address-from-spam-bots/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
