<?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>Opgenorth.NET &#187; javascript</title>
	<atom:link href="http://www.opgenorth.net/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.opgenorth.net</link>
	<description>Mindless missives of a .NET developer from the North</description>
	<lastBuildDate>Sat, 28 Aug 2010 15:58:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Javascript IDE&#8217;s</title>
		<link>http://www.opgenorth.net/2010/08/10/javascript-ides/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=javascript-ides</link>
		<comments>http://www.opgenorth.net/2010/08/10/javascript-ides/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 02:23:00 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.opgenorth.net/2008/11/15/javascript-ides/</guid>
		<description><![CDATA[Lately I’ve found myself doing a lot more web application development in JavaScript.&#160; Typically, I always seem to fall back on plain old Notepad++ or Visual Studio.&#160; As a developer, the user experience in either is, IMHO, somewhat lacking. However, for the past week, I’ve been using RubyMine.&#160; RubyMine is a Ruby on Rails IDE [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I’ve found myself doing a lot more web application development in JavaScript.&#160; Typically, I always seem to fall back on plain old Notepad++ or Visual Studio.&#160; As a developer, the user experience in either is, IMHO, somewhat lacking. </p>
<p>However, for the past week, I’ve been using <a href="http://www.jetbrains.com/ruby/index.html">RubyMine</a>.&#160; <a href="http://www.jetbrains.com/ruby/index.html">RubyMine</a> is a Ruby on Rails IDE from <a href="http://www.jetbrains.com">Jetbrains</a>, but it seems to work rather well for editing JavaScript and HTML files.&#160; Plus, as an added bonus, it automatically comes with built in support for <a href="http://www.jquery.com">jQuery</a>.</p>
<p>Curious about <a href="http://www.jetbrains.com/ruby/index.html">RubyMine</a>?&#160; Why not come to the <a href="http://www.edmontoncodecamp.com/">Edmonton Code Camp</a> on November 29th, 2008 and see it in action during my presentation on <a href="http://www.jquery.com">jQuery</a>?&#160; Or better yet, download your own copy and check it out.</p>
<p>&lt;rant&gt;    <br />Now this may strike the one or two readers of blog as odd (assuming they haven’t fallen asleep or navigated away by now) – a lot of what I do is ASP.NET Development (WebForms and ASP.NET MVC), so shouldn’t I have been doing a lot of JavaScript up to now?</p>
<p>Well, if you allow me to digress a bit, my answer to that is “No”.&#160; I’ve said it before, and I’ll say it again that, as a web developer relying very heavily on WebForms in the past, nothing has done more to emasculate my JavaScript skills than Microsoft’s ASP.NET WebForms.&#160; ASP.NET Webforms, with it’s emphasis on making development as VB6-like as possible, seems to encourage you do try and do everything server-side.&#160; I know that I’ve sat in on at least one presentation by Microsoft employees who have spoken disparagingly of JavaScript.&#160; This is just plain wrong, IMHO.&#160; Ask me why in person, if you’d like to hear the full rant.</p>
<p>Note:&#160; This is my opinion.&#160; Lots of people are happy with Webforms, and if you are, good for you.&#160; I’m not.&#160; Direct all comments and opinions on my viewpoint to /dev/null.&#160; </p>
<p>Of course, this rant doesn’t apply if you’re using ASP.NET MVC or MonoRail.    <br />&lt;/rant&gt;</p>
<p><em><strong>Updated August 10, 2010</strong> : A bit of time has passed since I first wrote this post, figured an update couldn’t hurt</em></p>
<p>These days I seem to use a combination of <a href="http://notepad-plus-plus.org/">Notepad++</a> and <a href="http://getfirebug.com/">Firebug</a>.&#160; Firebug truly rocks.&#160; It would be really nice if it worked for Internet Explorer, but it’s probably more realistic to hope for universal peace or an end to world hunger.&#160; I’m told IE9 is supposed to have some good stuff for JavaScript development, but I somehow doubt that will help me out when I have to debug IE7/IE8 issues.</p>
<p>I’ve had some people in the past suggest Visual Studio 2008 whenever I do an informal poll.&#160; Personally, I’ve found the JavaScript editing experience in VS2008 to be lacklustre at best.&#160; </p>
<p>When <a href="http://www.jetbrains.com/webstorm/">WebStorm</a> was in beta, I tried that combined with Firebug.&#160; I rather liked it for my JavaScript editing needs.&#160; </p>
<p>If you have any favourite tools (or IDE’s) to help with your JavaScript/jQuery development, I sure would like to hear about it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.opgenorth.net/2010/08/10/javascript-ides/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>You Can&#8217;t Change a &lt;input type=&quot;checkbox&quot; If You&#8217;re IE?</title>
		<link>http://www.opgenorth.net/2008/11/20/you-cant-change-a-input-typecheckbox-if-youre-ie/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=you-cant-change-a-input-typecheckbox-if-youre-ie</link>
		<comments>http://www.opgenorth.net/2008/11/20/you-cant-change-a-input-typecheckbox-if-youre-ie/#comments</comments>
		<pubDate>Fri, 21 Nov 2008 03:04:00 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.opgenorth.net/2008/11/20/you-cant-change-a-input-typecheckbox-if-youre-ie/</guid>
		<description><![CDATA[Update November 20th:&#160; Well, a quick search of StackOverflow.com, and it turns out that I’m not exactly alone in this matter.&#160; According to this post (and Grant in the comments of this post), in versions of IE &#60; 8, one must use the click event, and not the change event. I ran into an interesting [...]]]></description>
			<content:encoded><![CDATA[<p><em>Update November 20th:&#160; Well, a quick search of </em><a href="http://www.stackoverflow.com"><em>StackOverflow.com</em></a><em>, and it turns out that I’m not exactly alone in this matter.&#160; According to this </em><a href="http://stackoverflow.com/questions/208471/getting-jquery-to-recognise-change-in-ie"><em>post</em></a><em> (and Grant in the comments of this post), in versions of IE &lt; 8, one must use the click event, and not the change event.</em></p>
<p>I ran into an interesting issue today.&#160; I don&#8217;t really know the answer, but I figured I would blog about it so that I don&#8217;t completely forget it.&#160; While I highly doubt the two readers of my blog (my brother and sister) have any idea of what I&#8217;m talking about, I&#8217;m sure that eventually somebody (smart) will stumble upon this via Google.&#160; What will happen in that case is anybodies guess, but I digress&#8230;</p>
<p>I had some JavaScript (note that I&#8217;m using <a href="http://www.jquery.com">jQuery</a> too):</p>
<div class="csharpcode">
<pre><span class="lnum">   1:  </span>$(document).ready(<span class="kwrd">function</span>() {</pre>
<p>
    </p>
<pre><span class="lnum">   2:  </span>    $(<span class="str">'#myCheckbox'</span>).change(myCallBackFunction);</pre>
<p>
    </p>
<pre><span class="lnum">   3:  </span>}</pre>
<p>
    </p>
<pre><span class="lnum">   4:  </span></pre>
<p>
    </p>
<pre><span class="lnum">   5:  </span><span class="kwrd">function</span> myCallBackFunction() {</pre>
<p>
    </p>
<pre><span class="lnum">   6:  </span>   <span class="rem">// unwrap protein strings and cure cancer in parallel on a single core system</span></pre>
<p>
    </p>
<pre><span class="lnum">   7:  </span>}</pre>
</div>
<p><!--.csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<p>For the sake of completeness, here is a sample HTML snippet to go with the above jQuery:</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">input</span> <span class="attr">id</span><span class="kwrd">=&quot;myCheckBox&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;checkbox&quot;</span>  <span class="kwrd">&gt;</span></pre>
<p>Now, in FireFox 3, when you clicked on the checkbox, myCallBackFunction gets executed (as I would expect).&#160; However, in IE7, that doesn&#8217;t seem to happen.&#160; This has me stumped.</p>
<p>Now, at work, I asked &quot;Who is an expert in Javascript and jQuery?&quot;.&#160; Crickets chirped.&#160; Dead silence.&#160; A tumbleweed rolls on by.</p>
<p>I then asked &quot;Who wants to make Tom look stupid?&quot; &#8211; everybody jumps at the opportunity.&#160; Go figure.&#160; Anyway, back to our exciting tale.&#160; To get around this, I couldn&#8217;t rely on the collective brainpower of myself and my co-workers to figure out what the problem is.&#160; Instead, we deduced that it is better to go around the problem and try something different.&#160; I had&#160; to use the click event like so:</p>
<pre class="csharpcode">$(<span class="str">'#myCheckbox'</span>).click(myCallBackFunction);</pre>
<p><!--.csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<p>This works in both IE7 and FireFox 3 &#8211; not sure why.</p>
<p>Based on my past experiences with things, I&#8217;m sure it&#8217;s something I&#8217;m doing (or not doing).&#160; Going over my past experience, I&#8217;m sure it won&#8217;t be me who figures out what I&#8217;m doing wrong.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.opgenorth.net/2008/11/20/you-cant-change-a-input-typecheckbox-if-youre-ie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unit Testing in JavaScript</title>
		<link>http://www.opgenorth.net/2008/08/16/unit-testing-in-javascript/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=unit-testing-in-javascript</link>
		<comments>http://www.opgenorth.net/2008/08/16/unit-testing-in-javascript/#comments</comments>
		<pubDate>Sun, 17 Aug 2008 05:41:00 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://www.opgenorth.net/2008/08/16/unit-testing-in-javascript/</guid>
		<description><![CDATA[Well, I don&#8217;t know why it&#8217;s taken me so long to get to get around to this: but I must say that there are now a couple of &#34;must haves&#34; in my web developer&#8217;s tool box.&#160; One of them is jQuery, and now the other is QUnit. Chad Myers has a good, quick, post introducing [...]]]></description>
			<content:encoded><![CDATA[<p>Well, I don&#8217;t know why it&#8217;s taken me so long to get to get around to this: but I must say that there are now a couple of &quot;must haves&quot; in my web developer&#8217;s tool box.&#160; One of them is <a href="http://www.jquery.com">jQuery,</a> and now the other is <a href="http://docs.jquery.com/QUnit">QUnit</a>.</p>
<p><a href="http://www.lostechies.com/blogs/chad_myers/default.aspx">Chad Myers</a> has a good, quick, <a href="http://www.lostechies.com/blogs/chad_myers/archive/2008/08/28/getting-started-with-jquery-qunit-for-client-side-javascript-testing.aspx">post introducing QUnit</a>, I&#8217;d <em>strongly suggest</em> checking it out if you do web development (which, IMHO, implies some use of JavaScript, right?).&#160; Chad&#8217;s post covers the basics pretty good, and I think I would just be duplicating/plagiarizing Chad&#8217;s work if I were to blog the hour or two I spent getting to know QUnit here.</p>
<p>It is nice to see that JavaScript is slowly being recognized as first class citizen of the web programming world, and is gradually having it&#8217;s good name cleared of <a href="http://graysmatter.codivation.com/JavascriptRapedMyDogAndOtherFalsehoods.aspx">certain falsehoods</a>.&#160; It&#8217;s been my belief and observation for a while now that ASP.NET has done a pretty good job of stunting and retarding the adoption/use of JavaScript amongst .NET developers, at least in the Edmonton region.&#160; Good to see that this attitude is starting to change.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.opgenorth.net/2008/08/16/unit-testing-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.NET Web Services and jQuery/AJAX</title>
		<link>http://www.opgenorth.net/2008/05/22/asp-net-web-services-and-jqueryajax/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=asp-net-web-services-and-jqueryajax</link>
		<comments>http://www.opgenorth.net/2008/05/22/asp-net-web-services-and-jqueryajax/#comments</comments>
		<pubDate>Fri, 23 May 2008 06:22:00 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.opgenorth.net/2008/05/22/asp-net-web-services-and-jqueryajax/</guid>
		<description><![CDATA[As far as web developer&#8217;s go, I&#8217;ll freely admit that my Javascript is not one of my strong points.&#160; I don&#8217;t have a real good reason for this, it&#8217;s just that over the past few years I haven&#8217;t had much call/need to polish and hone my Javascript skills.&#160; Recently I discovered jQuery, and I must [...]]]></description>
			<content:encoded><![CDATA[<p>As far as web developer&#8217;s go, I&#8217;ll freely admit that my Javascript is not one of my strong points.&#160; I don&#8217;t have a real good reason for this, it&#8217;s just that over the past few years I haven&#8217;t had much call/need to polish and hone my Javascript skills.&#160; Recently I discovered <a href="http://www.jquery.com">jQuery</a>, and I must say that I wish I had know about this library earlier.&#160; The more I use <a href="http://www.jquery.com">jQuery</a>, the more I like it.&#160; The simple things are simple, and the hard things are possible.&#160; Take calling a simple webservice when the user clicks a button on a form.</p>
<p>Client side, the user would click on a button in their browser, in order to &quot;check out&quot; or &quot;check in&quot; &#8211; pretty simple stuff.&#160; Click a button, update a record in the database.&#160; I wanted this done via AJAX, as the page itself is pretty heavy with data, and I didn&#8217;t want to go through the whole page lifecycle.&#160; I spent some time Googling how to do this on the web, but I didn&#8217;t find anything that seemed to be suitable for something as simple as this.</p>
<p>So, enough boring stuff, on with the issue.&#160; In my current application the ASP.NET web service that the client should call looks something like:</p>
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">[ScriptService]
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> CampaignProductCheckoutService : WebService, ICampaignProductCheckoutService
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">{
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  [WebMethod]
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> CheckIn(<span style="color: #0000ff">int</span> campaignProductId, <span style="color: #0000ff">int</span> loginId)
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #008000">// Do something...</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  [WebMethod]
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> CheckOut(<span style="color: #0000ff">int</span> campaignProductId, <span style="color: #0000ff">int</span> loginId)
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #008000">// Do something...</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">}</pre>
</pre>
<p>Pretty simple webservice, nothing fancy.&#160; Here is the corresponding Javascript on the browser:</p>
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">$.ajax({
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  type: &quot;<span style="color: #8b0000">POST</span>&quot;,
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  url: &quot;<span style="color: #8b0000">CampaignProductCheckoutService.asmx/CheckOut</span>&quot;,
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  data: &quot;<span style="color: #8b0000">campaignProductId=3&amp;loginId=4</span>&quot;,
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  beforeSend: <span style="color: #0000ff">function</span>(xhr) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    xhr.setRequestHeader(&quot;<span style="color: #8b0000">Content-Length</span>&quot;, &quot;<span style="color: #8b0000">campaignProductId=3&amp;loginId=4</span>&quot;.<span style="color: #0000ff">length</span>);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    $(&quot;<span style="color: #8b0000">#progressBarContainer</span>&quot;).show();
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  },
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  dataType: &quot;<span style="color: #8b0000">xml</span>&quot;,
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  complete: <span style="color: #0000ff">function</span> (xhr, msg) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    $(&quot;<span style="color: #8b0000">#progressBarContainer</span>&quot;).hide();
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">if</span> (xhr.<span style="color: #0000ff">status</span> == 200) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">      <span style="color: #0000ff">alert</span>(&quot;<span style="color: #8b0000">Happy Times!</span>&quot;);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">else</span> {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">      <span style="color: #0000ff">alert</span>(&quot;<span style="color: #8b0000">Wailing and gnashing of teeth!</span>&quot;);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">});</pre>
</pre>
<p>This looks busy, but in reality, it isn&#8217;t. Now, for a detailed explanation of what is going on here, I&#8217;d suggest reading the book <a href="http://www.amazon.ca/gp/product/1933988355?ie=UTF8&amp;tag=opgenorthne08-20&amp;linkCode=as2&amp;camp=15121&amp;creative=330641&amp;creativeASIN=1933988355">jQuery in Action</a><img border="0" alt="" src="http://www.assoc-amazon.ca/e/ir?t=opgenorthne08-20&amp;l=as2&amp;o=15&amp;a=1933988355" width="1" height="1" />.&#160; It is a most helpful book for learning jQuery.</p>
<p>Anyway, here is a quick rundown of what is going on:&#160; the $.ajax is a jQuery method that will perform the AJAX call, using the parameters that we provide it.&#160; jQuery will perform an HTTP post to web service specified in url.&#160; As part of the POST request, you can see that we&#8217;re passing in the parameters for the webservice call.&#160; So far, pretty straightforward.</p>
<p>The next line, beforeSend, is a javascript method that jQuery will call before it does the POST.&#160; In this case, we make sure that the request header has the length of the data being sent, and we show a progress bar to the user.&#160; The funny syntax you see there is how we select the DIV element holding our animated gif and display it to the user.</p>
<p>Your standard ASP.NET web service will return XML to the client, and we inform jQuery of that with the dataType parameter.</p>
<p>By default, jQuery will perform the AJAX call asynchronously, so in the final line we provide another Javascript callback.&#160; jQuery will call this function once the request is finished.&#160; In this case, we hide the DIV element holding the progress bar, and we check the XMLHttpRequest object that is returned from jQuery. If the status is 200, then all okay and we display a happy message.&#160; Otherwise we assume the request failed, and display a sad message to the user. </p>
<p>There you have it, a quick and dirty explanation of using jQuery to call an ASP.NET Web Service.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.opgenorth.net/2008/05/22/asp-net-web-services-and-jqueryajax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript Didn’t Rape My Dog</title>
		<link>http://www.opgenorth.net/2007/11/09/javascript-didnt-rape-my-dog/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=javascript-didnt-rape-my-dog</link>
		<comments>http://www.opgenorth.net/2007/11/09/javascript-didnt-rape-my-dog/#comments</comments>
		<pubDate>Sat, 10 Nov 2007 01:21:00 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.opgenorth.net/2007/11/09/javascript-didnt-rape-my-dog/</guid>
		<description><![CDATA[One thing I noticed since I started doing ASP.NET programming back in 2002: I started using Javascript a lot less, and my copy of JavaScript: The Definitive Guide sits on the shelf gathering dust.&#160; I&#8217;ve noticed a lot of developers I&#8217;ve worked with are the same way. In fact, I&#8217;d say that most of the [...]]]></description>
			<content:encoded><![CDATA[<p>One thing I noticed since I started doing ASP.NET programming back in 2002: I started using Javascript a lot less, and my copy of JavaScript: The Definitive Guide sits on the shelf gathering dust.&#160; I&#8217;ve noticed a lot of developers I&#8217;ve worked with are the same way. In fact, I&#8217;d say that most of the ASP.NET programmers I&#8217;ve worked with these days really don&#8217;t know much about Javascript.</p>
<p>I don&#8217;t blame Javascript itself for this &#8211; I blame ASP.NET. Developers just get used to dropping the server side controls on their WebForms, and then doing everything server side. I&#8217;ve also worked at clients which had a &quot;no client-side javascript&quot; rule. All of this combines to cause our (my) Javascript skills to atrophy and wither. Kind of shame, really. (note: to a degree, I think the same can be said about CSS).</p>
<p>Now, I think that when MS-MVC is released, this will change. As places being to use MVC more, I can see Javascript becoming more important in my day to day work &#8211; perhaps even to the point of becoming a first-class language again.   <br />Javascript didn&#8217;t rape my dog &#8211; that&#8217;s because ASP.NET has pummelled my Javascript skills into a coma. But, I suspect that in the near future, a healthy dose of MS-MVC will revive my Javascript. I&#8217;d better start thinking about how to protect my dog.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.opgenorth.net/2007/11/09/javascript-didnt-rape-my-dog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
