<?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>Thronic.com &#187; AJAX</title>
	<atom:link href="http://thronic.com/category/development/ajax/feed/" rel="self" type="application/rss+xml" />
	<link>http://thronic.com</link>
	<description>Personal Computing and Development by Dag J. Nedrelid</description>
	<lastBuildDate>Wed, 28 Apr 2010 12:21:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>IE7 and onclick events</title>
		<link>http://thronic.com/2008/development/javascript/ie7-and-onclick-events/</link>
		<comments>http://thronic.com/2008/development/javascript/ie7-and-onclick-events/#comments</comments>
		<pubDate>Mon, 08 Dec 2008 01:06:35 +0000</pubDate>
		<dc:creator>Dag Jonny Nedrelid</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[WebDev]]></category>

		<guid isPermaLink="false">http://thronic.com/?p=60</guid>
		<description><![CDATA[The onclick event is getting more used than ever before these days as AJAX is becoming increasingly used for interactive web site functions. But there is a problem sometimes when using it with IE7.
An onclick event will work perfectly in Firefox, but when you try in Internet Explorer 7 (and maybe 6) it will seemingly [...]]]></description>
			<content:encoded><![CDATA[<p><strong>The onclick event is getting more used than ever before these days as AJAX is becoming increasingly used for interactive web site functions. But there is a problem sometimes when using it with IE7.</strong></p>
<p>An onclick event will work perfectly in Firefox, but when you try in Internet Explorer 7 (and maybe 6) it will seemingly bug out without any error or warnings at all.</p>
<p><span id="more-60"></span></p>
<p><strong>Reason</strong><br />
This is simply because of how IE decides to &#8220;remember&#8221; visited links (the one you call in the AJAX function), and it simply don&#8217;t run your onclick event more than perhaps once per click.</p>
<p>I solved this by adding something I&#8217;d like to call a no-cache-seed to the url that will be unique for every click, forcing the browser to handle every event as a new URL. Then it worked perfectly.</p>
<p>The following javascript snippet will create a variable with the number of seconds since January 1, 1970. Needless to say it will always be different unless you demand reaction times under 1 millisecond which is unrealistic from a single user.</p>
<blockquote><p><code>var currentTime = new Date();<br />
var nocacheseed = currentTime.getTime();</code></p></blockquote>
<p>Code in effect:<br />
http://example.com/file.php?foo=1&amp;bar=1&amp;nocacheseed=<script type="text/javascript">// <![CDATA[
  var currentTime = new Date();  var nocacheseed = currentTime.getTime(); document.write(nocacheseed);
// ]]&gt;</script></p>
<p>Reload the page to see how it is different every time.</p>
]]></content:encoded>
			<wfw:commentRss>http://thronic.com/2008/development/javascript/ie7-and-onclick-events/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AJAX basics in javascript</title>
		<link>http://thronic.com/2007/development/ajax-basics-in-javascript/</link>
		<comments>http://thronic.com/2007/development/ajax-basics-in-javascript/#comments</comments>
		<pubDate>Sun, 09 Dec 2007 12:50:25 +0000</pubDate>
		<dc:creator>Dag Jonny Nedrelid</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://thronic.com/?p=103</guid>
		<description><![CDATA[Illustrates the use of AJAX (Asynchronous JavaScript And XML). It involves a javascript function, third-party file saved on the server side to get data from, and a call being made to it from the client side without refreshing the browser &#8211; this is the main concept of AJAX.

First the javascript function.

function ajaxFunction() {
var xmlHttp;

if(window.XMLHttpRequest) {
 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Illustrates the use of AJAX (Asynchronous JavaScript And XML). It involves a javascript function, third-party file saved on the server side to get data from, and a call being made to it from the client side without refreshing the browser &#8211; this is the main concept of AJAX.</strong></p>
<p><span id="more-103"></span></p>
<p>First the javascript function.</p>
<blockquote>
<pre><code>function ajaxFunction() {
var xmlHttp;

if(window.XMLHttpRequest) {
  xmlHttp=new XMLHttpRequest();
} else if (window.ActiveXObject) {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
} else {
  alert("Your browser does not support AJAX!");
  return false;
}

xmlHttp.open("GET","links.txt",true);
xmlHttp.onreadystatechange=function() {
  if(xmlHttp.readyState==4) {
    document.getElementById('relatedLinks').innerHTML = xmlHttp.responseText;
  }
}
xmlHttp.send(null);
}
</code></pre>
</blockquote>
<p>The HTML.</p>
<blockquote><p><code> &lt;div id="relatedLinks"&gt;This will be filled with the link in links.txt.&lt;/div&gt;<br />
&lt;a href="#" onclick="ajaxFunction()"&gt;Click me to change div content&lt;/a&gt; </code></p></blockquote>
<p>And the links.txt.</p>
<blockquote><p><code> &lt;a href="http://www.domain.com/"&gt;The Domain!&lt;/a&gt; </code></p></blockquote>
<p>Sending GET data example</p>
<blockquote><p><code> xmlHttp.open("GET","getreceiver.php?foo=bar",true);<br />
xmlHttp.send(null); </code></p></blockquote>
<p>Sending POST data example</p>
<blockquote><p><code> xmlHttp.open("POST","postreceiver.php",true);<br />
xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');<br />
xmlHttp.send('foo=bar');<br />
</code></p></blockquote>
<p>One thing I had a problem with when playing around in the beginning was that you can&#8217;t call data sources outside of the domain of the file calling it, this is a safety measure in some browsers. There are some ways to get outside this. Absolutely nice to know in advance to save some headache.</p>
<p>Deeper details of AJAX can be found through an online search engine very easily.</p>
<p>Microsoft.XMLHTTP might be worth checking for as well if the browser check above fails. There are many ways and means of checking validation of browsers, the one illustrated is just one of them.</p>
]]></content:encoded>
			<wfw:commentRss>http://thronic.com/2007/development/ajax-basics-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
