<?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>Fremus.co.za &#187; Javascript</title>
	<atom:link href="http://www.fremus.co.za/blog/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.fremus.co.za/blog</link>
	<description>Demistifying Life and Web Development</description>
	<lastBuildDate>Wed, 08 Sep 2010 18:18:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>JavaScript alphabetical sorting (A is less than a)</title>
		<link>http://www.fremus.co.za/blog/2009/10/javascript-alphabetical-sorting-a-a/</link>
		<comments>http://www.fremus.co.za/blog/2009/10/javascript-alphabetical-sorting-a-a/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 14:24:53 +0000</pubDate>
		<dc:creator>fr3dr1k</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Web Technologies]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.fremus.co.za/blog/?p=532</guid>
		<description><![CDATA[So A < a, which means if you use the sort() function and your array contains elements starting with upper and lowercase then the uppercase will appear first, i.e.: Art, ASP.NET, LawDeed, LINQ will appear as: ASP.NET Art LawDeed LINQ To get this working correctly you need the following function: charOrdA: function(a, b) { a [...]]]></description>
			<content:encoded><![CDATA[<p>So A < a, which means if you use the sort() function and your array contains elements starting with upper and lowercase then the uppercase will appear first, i.e.:</p>
<p>Art, ASP.NET, LawDeed, LINQ will appear as:<br />
ASP.NET<br />
Art<br />
LawDeed<br />
LINQ</p>
<p>To get this working correctly you need the following function:</p>
<pre name="code" class="javascript">
    charOrdA: function(a, b) {
        a = a.toLowerCase(); b = b.toLowerCase();
        if (a > b) return 1;
        if (a < b) return -1;
        return 0;
    }
</pre>
<p>This function will make sure your alphabetical sortorder is correct so that the list appears like this:<br />
Art<br />
ASP.NET<br />
LawDeed<br />
LINQ</p>
<p>You have to pass the function name to the sort function like this:</p>
<pre name="code" class="javascript">

arrCategories.sort(charOrdA);
</pre>
<p>Note that there are no parenthesis.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save" onclick="urchinTracker('/outgoing/www.addtoany.com/share_save?referer=');"><img src="http://www.fremus.co.za/blog/wp-content/plugins/add-to-any/favicon.png" width="16" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.fremus.co.za/blog/2009/10/javascript-alphabetical-sorting-a-a/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Choosing a JavaScript library/strategy</title>
		<link>http://www.fremus.co.za/blog/2009/10/choosing-a-javascript-librarystrategy/</link>
		<comments>http://www.fremus.co.za/blog/2009/10/choosing-a-javascript-librarystrategy/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 07:20:26 +0000</pubDate>
		<dc:creator>fr3dr1k</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.fremus.co.za/blog/?p=530</guid>
		<description><![CDATA[JQuery, prototype, scriptalicious, moo tools and Microsoft Ajax are all JavaScript libraries that encapsulate common functionality, or rather commonly repeated tasks, into a re-usable form. One such example is accessing DOM elements. Usually you would type document.getElementById to get to a div element for example, which also implies for each element you access you have [...]]]></description>
			<content:encoded><![CDATA[<p>JQuery, prototype, scriptalicious, moo tools and Microsoft Ajax are all JavaScript libraries that encapsulate common functionality, or rather commonly repeated tasks, into a re-usable form. One such example is accessing DOM elements. Usually you would type document.getElementById to get to a div element for example, which also implies for each element you access you have to type document.getElementById. Most JavaScript libraries provide an easy way to access elements, usually through a dollar($). In jQuery you simply type $(&#8216;elementID&#8217;) and in Microsoft Ajax you type $get(&#8216;elementID&#8217;) to get to the object. So basically the library has encapsulated the document.getElementById in some JavaScript function, and that function simply returns the object. Most JavaScript libraries also provide built-in AJAX functionality, which means that the library makes it easy to create XMLHTTPRequests. The libraries also make it easy to do all kinds of special effects such as animations and modal popups.</p>
<p>So which one do you use? What determines which one you use? Well personally I would take a pragmatic approach and say that no matter which library you choose, you still have to learn the basic concepts such as how HTTP requests work and how things are executed. Once these things are understood you can pick a library and make sure you learn it. Whether you pick jQuery or Microsoft Ajax is irrelevant, because with both you will have to spend time learning how the API works. I often find myself in a situation where I want to jump between libraries because I feel that there is a wow feature in the one and not the other. I also find myself creating my own JavaScript at times because I just don&#8217;t need the entire library. The most important thing to know though is that you have to commit your time and energy to learning JavaScript with or without the use of a library.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save" onclick="urchinTracker('/outgoing/www.addtoany.com/share_save?referer=');"><img src="http://www.fremus.co.za/blog/wp-content/plugins/add-to-any/favicon.png" width="16" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.fremus.co.za/blog/2009/10/choosing-a-javascript-librarystrategy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mimicking AJAX behaviour with Generic Handler (.ashx) file uploader</title>
		<link>http://www.fremus.co.za/blog/2009/10/mimicking-ajax-behaviour-with-generic-handler-ashx-file-uploader/</link>
		<comments>http://www.fremus.co.za/blog/2009/10/mimicking-ajax-behaviour-with-generic-handler-ashx-file-uploader/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 18:23:28 +0000</pubDate>
		<dc:creator>fr3dr1k</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.fremus.co.za/blog/?p=528</guid>
		<description><![CDATA[Earlier today I posted a blog about using a generic handler (.ashx) to upload a file to a web server, and in the back of my head I wanted to use it somewhere neat and special, and I also want to find the most reliable and working version. And I also want to learn what [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier today I posted a blog about using a generic handler (.ashx) to upload a file to a web server, and in the back of my head I wanted to use it somewhere neat and special, and I also want to find the most reliable and working version. And I also want to learn what the approaches are to doing so, and why not to do it a certain way, etc.</p>
<p>So back to the topic of the post and the first thing that needs to be understood is that you CANNOT upload files with AJAX/JavaScript. This is because of you cannot retrieve the contents of a file off a local system, and if this was so it would cause major security headaches. So what I ended up doing is following the IFRAME approach, by which you make it look as if the upload is happening all AJAX-like when in actual fact its not. So what I did was create an IFRAME:</p>
<pre name="code" class="html">
<div id="divFrame">
        <iframe id="objIframe" scrolling="no" frameborder="0" hidefocus="true"
            style="text-align: center; vertical-align: middle; border-style: none; margin: 0px;
            width: 100%; height: 55px" src="Uploader.htm"></iframe>
    </div>
<div id="divTimerValue" style="display:none">busy</div>
</pre>
<p>Notice that I added a div called divTimerValue, which I use to display some progress indicator, in my case it will be busy that will grow and subside with dots. In the source file (where the IFRAME points to) I create a form:</p>
<pre name="code" class="html">
<form action="ReturnValue.ashx" method="post" enctype="multipart/form-data">
    <label for="file">
        Filename:</label>
<input type="file" name="file" id="file" />
<input type="submit" name="submit" value="Submit" id="btnUpload" onclick="dotsAnimate();" />
    </form>
</pre>
<p>Notice that it has the ReturnValue.ashx action and that I have added an onclick function to the submit button, which looks like this:</p>
<pre name="code" class="javascript">
        function dotsAnimate() {
            parent.document.getElementById("divFrame").style.display = 'none';
            var dotspan = parent.document.getElementById("divTimerValue");
            dotspan.style.display = '';
            setInterval(function() {
                if (dotspan.innerHTML == 'busy...') {
                    dotspan.innerHTML = 'busy.';
                }
                else {
                    dotspan.innerHTML += '.';
                }
            }, 1000);
        };
</pre>
<p>The dotsAnimate function uses the setTimeout function to create the animation. The generic handler then returns some HTML that contains a javascript function that clears the timeout and prints a message in the divTimerValue div:</p>
<pre name="code" class="csharp">
        context.Response.Write(@"<script type=""text/javascript"">function myFunction2(){clearInterval();parent.document.getElementById('divTimerValue').innerHTML = 'done';};myFunction2();</script>");
        context.Response.Write(savedFileName);
</pre>
<p>And this code produces the desired result.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save" onclick="urchinTracker('/outgoing/www.addtoany.com/share_save?referer=');"><img src="http://www.fremus.co.za/blog/wp-content/plugins/add-to-any/favicon.png" width="16" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.fremus.co.za/blog/2009/10/mimicking-ajax-behaviour-with-generic-handler-ashx-file-uploader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Is JavaScript object oriented?</title>
		<link>http://www.fremus.co.za/blog/2009/09/is-javascript-object-oriented/</link>
		<comments>http://www.fremus.co.za/blog/2009/09/is-javascript-object-oriented/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 10:54:14 +0000</pubDate>
		<dc:creator>fr3dr1k</dc:creator>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.fremus.co.za/blog/?p=431</guid>
		<description><![CDATA[When I started my career about 5 or so years ago I didnt know much about JavaScript, but I knew something about object oriented analysis and design. OOAD in this case was the classical approach to OO where an object is an instance, which means that each thing or object that you create in a [...]]]></description>
			<content:encoded><![CDATA[<p>When I started my career about 5 or so years ago I didnt know much about JavaScript, but I knew something about object oriented analysis and design. OOAD in this case was the classical approach to OO where an object is an instance, which means that each thing or object that you create in a system must first be instantiated, and this is something that does not happen in JavaScript at all really. Everything in JavaScript is object-based, there is no class instantiating as in the classical OO approach. The other thing that is quite notable is that it takes a bit of a work around to create some sort of inheritance in JavaScript, its not something that exists in the language itself. Similarly a thing like polymorphism is not a language feature as it is in say C#. With all that being said though, it does not mean that these features cannot be created in JavaScript, it just means JavaScript kinda works better without them. </p>
<p>It&#8217;s amazing then to hear an experienced JavaScript developer then speak of JavaScript being object oriented because it supports basic dot notation, even though the language itself is not object oriented in the classical sense.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save" onclick="urchinTracker('/outgoing/www.addtoany.com/share_save?referer=');"><img src="http://www.fremus.co.za/blog/wp-content/plugins/add-to-any/favicon.png" width="16" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.fremus.co.za/blog/2009/09/is-javascript-object-oriented/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Understanding JavaScript from a C# developer&#8217;s perspective</title>
		<link>http://www.fremus.co.za/blog/2009/01/understanding-javascript-from-a-c-developers-perspective/</link>
		<comments>http://www.fremus.co.za/blog/2009/01/understanding-javascript-from-a-c-developers-perspective/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 09:01:00 +0000</pubDate>
		<dc:creator>fr3dr1k</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Web Technologies]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.fremus.co.za/blog/?p=349</guid>
		<description><![CDATA[So during the week I did a lot of JavaScript and the thing that I found most, what shall I say, mindshiftable, is that you cannot think in the classical OOP way with JavaScript, as you do with C#. JavaScript does everything in functions, and everything within JavaScript is prototypical. Inheritance is prototypical, everything is [...]]]></description>
			<content:encoded><![CDATA[<p>So during the week I did a lot of JavaScript and the thing that I found most, what shall I say, <em>mindshiftable</em>, is that you cannot think in the classical OOP way with JavaScript, as you do with C#. JavaScript does everything in functions, and everything within JavaScript is prototypical. Inheritance is prototypical, everything is prototypical. You dont create instances of objects but rather use the objects themselves. So its kinda like a static class, where you invoke members directly. </p>
<p>I started this week by looking at a SOAP client written in JavaScript that makes calls to web services. What the SOAP client basically does is cache the WSDL with all the functions in it, from a web service (in this case an asmx file), and then it sends SOAP requests, processes the request and if there is a callback it does the callback function. The code for the SOAP client is based on <a href="http://www.codeproject.com/KB/ajax/JavaScriptSOAPClient.aspx" onclick="urchinTracker('/outgoing/www.codeproject.com/KB/ajax/JavaScriptSOAPClient.aspx?referer=');">this code</a>.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save" onclick="urchinTracker('/outgoing/www.addtoany.com/share_save?referer=');"><img src="http://www.fremus.co.za/blog/wp-content/plugins/add-to-any/favicon.png" width="16" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.fremus.co.za/blog/2009/01/understanding-javascript-from-a-c-developers-perspective/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unobtrusive JavaScript and a Session-less shopping cart</title>
		<link>http://www.fremus.co.za/blog/2008/11/unobtrusive-javascript-and-a-session-less-shopping-cart/</link>
		<comments>http://www.fremus.co.za/blog/2008/11/unobtrusive-javascript-and-a-session-less-shopping-cart/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 19:05:44 +0000</pubDate>
		<dc:creator>fr3dr1k</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.fremus.co.za/blog/?p=254</guid>
		<description><![CDATA[What is the idea behind unobtrusive JavaScript? What makes JavaScript unobtrusive? Does it mean removing any onlclick events in your markup and handling those click events with an approach as provided with jQuery? With jQuery its very (extremely) easy to traverse between DOM elements and its even easier associating events to elements and executing them. [...]]]></description>
			<content:encoded><![CDATA[<p>What is the idea behind unobtrusive JavaScript? What makes JavaScript unobtrusive? Does it mean removing any onlclick events in your markup and handling those click events with an approach as provided with jQuery? With jQuery its very (extremely) easy to traverse between DOM elements and its even easier associating events to elements and executing them.</p>
<p>I havent been doing a lot of JavaScript recently but you cannot really avoid it, but you can also not build an entire website with JavaScript and HTTPRequests alone (not search engine friendly), but you can also not rely entirely on server side code to do all the magic for you.</p>
<p>The other issue that has been bugging me of late is the idea of creating a session-less shopping basket, a shopping basket that uses a combination of web services and traditional classes. Within the .NET environment the only reason you might need to use sessions is to store DataTables or DataSets, but the question is how expensive is that on server resources. Would I be able to create the same session-based application with web services and traditional classes? After all you are adding web references to your web applications, and those web references all contain class declarations. </p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save" onclick="urchinTracker('/outgoing/www.addtoany.com/share_save?referer=');"><img src="http://www.fremus.co.za/blog/wp-content/plugins/add-to-any/favicon.png" width="16" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.fremus.co.za/blog/2008/11/unobtrusive-javascript-and-a-session-less-shopping-cart/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web Design Techniques</title>
		<link>http://www.fremus.co.za/blog/2008/06/web-design-techniques-rounded-corners/</link>
		<comments>http://www.fremus.co.za/blog/2008/06/web-design-techniques-rounded-corners/#comments</comments>
		<pubDate>Sat, 07 Jun 2008 09:32:13 +0000</pubDate>
		<dc:creator>fr3dr1k</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Web Technologies]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.fremus.co.za/blog/?p=20</guid>
		<description><![CDATA[There are a couple of design techniques that I have not spent enough time to learn, or master. Web design is not one of my strong abilities, but it is a skill that I believe you can learn and become good at. As with a lot of things good web designs can be created by [...]]]></description>
			<content:encoded><![CDATA[<p>There are a couple of design techniques that I have not spent enough time to learn, or master. Web design is not one of my strong abilities, but it is a skill that I believe you can learn and become good at. As with a lot of things good web designs can be created by following some basic principles and guidelines. One key thing that I have not yet mastered is designing nice rounded corners for buttons or areas of content. It has to be mentioned that there are a two basic ways of achieving the rounded corner effect:</p>
<ol>
<li>JavaScript</li>
<li>CSS and Images</li>
</ol>
<p>What are the benefits of both or either method? ASP.NET Ajax provides a rounded corner control that is extremely easy to implement on an ASP.NET website. What if you do not use ASP.NET? Well then you can use <a href="http://www.html.it/articoli/niftycube/index.html" onclick="urchinTracker('/outgoing/www.html.it/articoli/niftycube/index.html?referer=');">Nifty Corners</a> to add rounded corners to your website. </p>
<p>After searching Google for articles on rounded corners, I came across <a href="http://www.456bereastreet.com/archive/200505/transparent_custom_corners_and_borders/" onclick="urchinTracker('/outgoing/www.456bereastreet.com/archive/200505/transparent_custom_corners_and_borders/?referer=');"> an article on 456 Berea Street</a> that explains how to use Javascript and CSS to achieve the rounded corner effect. Strangely enough they don&#8217;t seem to use that effect immediately on their own website. How important is it to use rounded corners on a website?</p>
<p><strong>CSS Balanced Columns</strong><br />
This is another technique worth knowing. Faux columns without using images? Now thats interesting. <a href="http://www.paulbellows.com/getsmart/balance_columns/" onclick="urchinTracker('/outgoing/www.paulbellows.com/getsmart/balance_columns/?referer=');">Balance your CSS Columns with JavaScript</a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save" onclick="urchinTracker('/outgoing/www.addtoany.com/share_save?referer=');"><img src="http://www.fremus.co.za/blog/wp-content/plugins/add-to-any/favicon.png" width="16" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.fremus.co.za/blog/2008/06/web-design-techniques-rounded-corners/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What is AJAX? Part2</title>
		<link>http://www.fremus.co.za/blog/2008/05/what-is-ajax-part2/</link>
		<comments>http://www.fremus.co.za/blog/2008/05/what-is-ajax-part2/#comments</comments>
		<pubDate>Sun, 04 May 2008 17:21:08 +0000</pubDate>
		<dc:creator>fr3dr1k</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Web Technologies]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[W3C]]></category>

		<guid isPermaLink="false">http://www.fremus.co.za/blog/?p=13</guid>
		<description><![CDATA[This article and its contents are based on the articles on the W3C Website, and is a great place to start learning. AJAX uses the XMLHTTPRequest JavaScript object to communicate directly with the web server and has three important properties: the onreadystatechange property the readystate property the responsetext property It&#8217;s important to note that the [...]]]></description>
			<content:encoded><![CDATA[<p>This article and its contents are based on the articles on the <a href="http://www.w3schools.com/default.asp" onclick="urchinTracker('/outgoing/www.w3schools.com/default.asp?referer=');">W3C Website</a>, and is a great place to start learning. </p>
<p>AJAX uses the XMLHTTPRequest JavaScript object to communicate directly with the web server and has three important properties:</p>
<ul>
<li>the onreadystatechange property</li>
<li>the readystate property</li>
<li>the responsetext property</li>
</ul>
<p>It&#8217;s important to note that the XMLHTTPRequest object is not supported by Internet Explorer which uses an ActiveX object, and for that reason when you create an XMLHTTPObject in JavaScript you have to add a few try/catch statements so that it returns the correct object for the correct browser. </p>
<p>If you want to use AJAX on a webpage it is thus important to understand that you need an XMLHTTPRequest object to make it possible. JavaScript is used to create the XMLHTTPRequest object and looks like this:</p>
<pre name="code" class="js">
function GetXMLHTTPObject()
{
     var xmlHttp = null;
     try
     {
          xmlHTTP = new XMLHttpRequest();
      }
      catch(e)
      {
          try
          {
              xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
          }
          catch(e)
          {
              xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
          }
      }
     return xmlHttp;
}
</pre>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save" onclick="urchinTracker('/outgoing/www.addtoany.com/share_save?referer=');"><img src="http://www.fremus.co.za/blog/wp-content/plugins/add-to-any/favicon.png" width="16" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.fremus.co.za/blog/2008/05/what-is-ajax-part2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What is AJAX? Part1</title>
		<link>http://www.fremus.co.za/blog/2008/05/what-is-ajax/</link>
		<comments>http://www.fremus.co.za/blog/2008/05/what-is-ajax/#comments</comments>
		<pubDate>Sat, 03 May 2008 16:02:30 +0000</pubDate>
		<dc:creator>fr3dr1k</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Web Technologies]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[LiveValidation]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.fremus.co.za/blog/?p=12</guid>
		<description><![CDATA[I downloaded the LiveValidation script recently and I realised after implementing it on a webpage I did not understand how it interacts with a PHP or ASP.NET application and it got me thinking that maybe I need to just try and understand how server-side and client-side code interacts with JavaScript. What is AJAX? I know [...]]]></description>
			<content:encoded><![CDATA[<p>I downloaded the LiveValidation script recently and I realised after implementing it on a webpage I did not understand how it interacts with a PHP or ASP.NET application and it got me thinking that maybe I need to just try and understand how server-side and client-side code interacts with JavaScript.</p>
<p>What is AJAX? I know it&#8217;s an acronym for Asynchronous JavaScript and XML, but what does it really mean and how does it work. Client- and Server-side scripting is easy to understand on their own and its easy to understand how both technologies are used, but where it becomes tricky for myself is when the server-side and client-side code need to interact with each other. Developing web applications with ASP.NET does not always expose a developer to the inner workings of that specific technology. AJAX is not unique to PHP or ASP.NET. Both ASP.NET and PHP are server side scripting languages. The first thing to understand is that AJAX is not a technology on its own, nor is it something that has not been there before, because it uses existing technologies (JavaScript, XML) to do what it does. AJAX uses a combination of programming tools to create web-based applications that react more like software applications &#8211; this means that the web-based application responds much smoother and nicer and the page does not reload to retrieve new content. </p>
<p>I still have not defined what AJAX looks like or what it exactly does. AJAX is based on open standards such as HTML, CSS, XML and JavaScript. AJAX uses XML and HTTP Requests to communicate with a web server. Another important thing to note is that with AJAX web applications do not re-submit a web page every time a user makes a request. If for example a user enters data on a form and submits the information to a web server, the web server will traditionally create a new page after the submit has occurred, but AJAX communicates with the web server in such a way that updates to the page only happen to the sections of the page that are affected.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save" onclick="urchinTracker('/outgoing/www.addtoany.com/share_save?referer=');"><img src="http://www.fremus.co.za/blog/wp-content/plugins/add-to-any/favicon.png" width="16" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.fremus.co.za/blog/2008/05/what-is-ajax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AJAX form validation &#8211; LiveValidation</title>
		<link>http://www.fremus.co.za/blog/2008/05/ajax-form-validation-livevalidation/</link>
		<comments>http://www.fremus.co.za/blog/2008/05/ajax-form-validation-livevalidation/#comments</comments>
		<pubDate>Thu, 01 May 2008 15:56:26 +0000</pubDate>
		<dc:creator>fr3dr1k</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Web Technologies]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Amaya]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[LiveValidation]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[prototype]]></category>

		<guid isPermaLink="false">http://www.fremus.co.za/blog/?p=9</guid>
		<description><![CDATA[Here&#8217;s the thing right, I really want to create a nice contact form for my website, but I also want to make sure that the form accepts the right type of information. For this I need some JavaScript and of late I have been reading a lot about JavaScript libraries such as jquery, mootools and [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s the thing right, I really want to create a nice contact form for my website, but I also want to make sure that the form accepts the right type of information. For this I need some JavaScript and of late I have been reading a lot about JavaScript libraries such as jquery, mootools and prototype. I have also worked a bit with ASP.NET Ajax, but I do find the .NET implementation does hide a lot of the inner workings of the JavaScript and does not force you to understand the core references as some of the other JavaScript libraries do. With .NET you can get some AJAX running without touching much JavaScript code at all.</p>
<p>So the contact form on my website should allow visitors to send an email with their name, email address and a message. All three fields are required and should not contain empty values. The validation will be done server side, so that the user can see what they are doing wrong immediately and take any necessary steps to correct the information they entered. </p>
<p>One thing that has been bugging me recently has been to find an easy way to validate forms, and I came across <a href="http://www.livevalidation.com/" onclick="urchinTracker('/outgoing/www.livevalidation.com/?referer=');">LiveValidation</a>. It&#8217;s pretty easy to setup and use, and I will be using it to create the form described above.</p>
<p>I also downloaded <a href="http://www.w3.org/Amaya/" onclick="urchinTracker('/outgoing/www.w3.org/Amaya/?referer=');">Amaya</a>, an free XHTML editor, since I am extremely keen on sticking to Web Standards and all.</p>
<p>The basic structure for the form can be seen <a href="http://www.fremus.co.za/test/fremus.co.za/">here</a>. The form requires all three fields and validates the email address field, and if the email address field is found to be valid a alert message box appears on the screen. The underlying JavaScript code is quite interesting to note:</p>
<pre name="code" class="js">
var fld_name = new LiveValidation( 'fld_name', {onlyOnSubmit: true } );
fld_name.add(Validate.Presence);
var fld_email = new LiveValidation( 'fld_email', {onlyOnSubmit: true } );
fld_email.add(Validate.Email);
fld_email.add(Validate.Presence);
var fld_msg = new LiveValidation( 'fld_msg', {onlyOnSubmit: true } );
fld_msg.add(Validate.Presence);
var automaticOnSubmit = fld_email.form.onsubmit;
fld_email.form.onsubmit = function(){
    var valid = automaticOnSubmit();
    if(valid)alert('Thank you for submitting your message!');
    return false;
}
</pre>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save" onclick="urchinTracker('/outgoing/www.addtoany.com/share_save?referer=');"><img src="http://www.fremus.co.za/blog/wp-content/plugins/add-to-any/favicon.png" width="16" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.fremus.co.za/blog/2008/05/ajax-form-validation-livevalidation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
