<?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>ITmeze &#187; jquery</title>
	<atom:link href="http://itmeze.com/tag/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://itmeze.com</link>
	<description>IT world served like Cyprus meze</description>
	<lastBuildDate>Thu, 07 Apr 2011 09:55:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>jQuery style Ui dialog over flash banners</title>
		<link>http://itmeze.com/2011/02/20/jquery-style-ui-dialog-over-flash-banners/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jquery-style-ui-dialog-over-flash-banners</link>
		<comments>http://itmeze.com/2011/02/20/jquery-style-ui-dialog-over-flash-banners/#comments</comments>
		<pubDate>Sun, 20 Feb 2011 18:00:52 +0000</pubDate>
		<dc:creator>ITmeze</dc:creator>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[dialog]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://itmeze.com/?p=339</guid>
		<description><![CDATA[I was doing some extra job for one of the clients, some changes on the web site full of blinking flash banners. Idea was to get users&#8217; attention even more by displaying some floating windows&#8230; lovely &#8230; Obvious choice would be jQuery modal dialog&#8230; So I made it &#8230; Unfortunately it has shown up that some of [...]
Related posts:<ol>
<li><a href='http://itmeze.com/2010/11/11/silverlight-flash-and-html5-on-job-market/' rel='bookmark' title='Silverlight, Flash and HTML5 on job market'>Silverlight, Flash and HTML5 on job market</a></li>
<li><a href='http://itmeze.com/2009/10/19/short-history-of-facebook/' rel='bookmark' title='Short history of Facebook'>Short history of Facebook</a></li>
<li><a href='http://itmeze.com/2009/08/13/tips-for-jquery-validation-plugin/' rel='bookmark' title='Tips for jQuery validation plugin'>Tips for jQuery validation plugin</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-7051816622200841";
google_ad_slot = "0915606426";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<br />
I was doing some extra job for one of the clients, some changes on the web site full of blinking flash banners.</p>
<p>Idea was to get users&#8217; attention even more by displaying some floating windows&#8230; lovely &#8230;</p>
<p>Obvious choice would be jQuery modal dialog&#8230; So I made it &#8230; Unfortunately it has shown up that some of the flash banners remain &#8216;over&#8217; the dialog, and some of them don&#8217;t. After digging into that I figured out that the reason behind that is one of flash parameters: &#8220;wmode&#8221; (thanks God this is not another inner flash issue).<br />
From Adome Knowledge base:</p>
<blockquote><p>
<code>wmode</code> &#8211; Possible values: window, opaque, transparent. Sets the Window Mode property of the Flash movie for transparency, layering, and positioning in the browser.</p>
<ul>
<li><code>window</code> &#8211; movie plays in its own rectangular window on a web page.</li>
<li><code>opaque</code> &#8211; the movie hides everything on the page behind it.</li>
<li><code>transparent</code> &#8211; the background of the HTML page shows through all transparent portions of the movie. This option can slow animation performance.</li>
</ul>
</blockquote>
<p>So, to fix that You need to set this parameter to &#8216;transparent&#8217;. Fortunately all flash objects were placed with swfobject scripts. Sample code to fix that issue may look like may look like (video from YouTube): </p>
<pre class="brush: jscript; title: ; notranslate">
    $(document).ready(function () {
        // The video to load.
        var videoID = &quot;xxx&quot;;
        // Lets Flash from another domain call JavaScript
        var params = { allowScriptAccess: &quot;always&quot;, wmode: &quot;transparent&quot; };
        // The element id of the Flash embed
        var atts = { id: &quot;ytPlayer&quot; };
        // All of the magic handled by SWFObject
        swfobject.embedSWF(&quot;http://www.youtube.com/v/&quot; + videoID + &quot;&amp;#038;enablejsapi=1&amp;#038;playerapiid=player1&quot;,
                       &quot;videoDiv&quot;, &quot;420&quot;, &quot;258&quot;, &quot;8&quot;, null, null, params, atts);
    });
</pre>
<p>Hope this saves some of Your precious time&#8230;</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fitmeze.com%2F2011%2F02%2F20%2Fjquery-style-ui-dialog-over-flash-banners%2F&amp;title=jQuery%20style%20Ui%20dialog%20over%20flash%20banners" id="wpa2a_2"><img src="http://itmeze.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>Related posts:<ol>
<li><a href='http://itmeze.com/2010/11/11/silverlight-flash-and-html5-on-job-market/' rel='bookmark' title='Silverlight, Flash and HTML5 on job market'>Silverlight, Flash and HTML5 on job market</a></li>
<li><a href='http://itmeze.com/2009/10/19/short-history-of-facebook/' rel='bookmark' title='Short history of Facebook'>Short history of Facebook</a></li>
<li><a href='http://itmeze.com/2009/08/13/tips-for-jquery-validation-plugin/' rel='bookmark' title='Tips for jQuery validation plugin'>Tips for jQuery validation plugin</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://itmeze.com/2011/02/20/jquery-style-ui-dialog-over-flash-banners/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Client side validation after Ajax Partial View result in ASP.NET MVC 3</title>
		<link>http://itmeze.com/2010/10/08/client-side-validation-after-ajax-partial-view-result-in-asp-net-mvc-3/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=client-side-validation-after-ajax-partial-view-result-in-asp-net-mvc-3</link>
		<comments>http://itmeze.com/2010/10/08/client-side-validation-after-ajax-partial-view-result-in-asp-net-mvc-3/#comments</comments>
		<pubDate>Fri, 08 Oct 2010 20:59:42 +0000</pubDate>
		<dc:creator>ITmeze</dc:creator>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[asp.net-mvc]]></category>
		<category><![CDATA[client side validation]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[unobtrusive javascript]]></category>

		<guid isPermaLink="false">http://itmeze.com/?p=290</guid>
		<description><![CDATA[Now, as ASP.NET MVC 3 beta was finally released I have decided to give it a try. The most exciting thing that I have noticed is implementation of an idea of so called Unobtrusive JavaScript. This is for both Ajax helpers and Client Validation. And I have to admit that I just love it. I [...]
Related posts:<ol>
<li><a href='http://itmeze.com/2010/12/06/checkbox-has-to-be-checked-with-unobtrusive-jquery-validation-and-asp-net-mvc-3/' rel='bookmark' title='Checkbox has to be &#8216;checked&#8217; &#8211; with unobtrusive jQuery validation and ASP.NET MVC 3'>Checkbox has to be &#8216;checked&#8217; &#8211; with unobtrusive jQuery validation and ASP.NET MVC 3</a></li>
<li><a href='http://itmeze.com/2009/08/13/tips-for-jquery-validation-plugin/' rel='bookmark' title='Tips for jQuery validation plugin'>Tips for jQuery validation plugin</a></li>
<li><a href='http://itmeze.com/2011/03/21/javascript-encode-on-server-side-medium-trust-environment/' rel='bookmark' title='Javascript Encode on server side &#8211; Medium Trust Environment'>Javascript Encode on server side &#8211; Medium Trust Environment</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-7051816622200841";
google_ad_slot = "0915606426";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
<p>Now, as ASP.NET MVC 3 beta was finally released I have decided to give it a try.</p>
<p>The most exciting thing that I have noticed is implementation of an idea of so called <a href="http://en.wikipedia.org/wiki/Unobtrusive_JavaScript">Unobtrusive JavaScript</a>. This is for both Ajax helpers and Client Validation. And I have to admit that I just love it.</p>
<p>I wll just copy and paste text from scottgu blog:</p>
<blockquote><p><strong>Unobtrusive JavaScript and HTML 5</strong>: The AJAX and Validation helpers in ASP.NET MVC now both use an <a href="http://en.wikipedia.org/wiki/Unobtrusive_JavaScript" target="_blank">unobtrusive JavaScript</a> approach by default. Unobtrusive JavaScript avoid injecting inline JavaScript into HTML, and instead enables cleaner separation of behavior using the new HTML 5 data- convention (which conveniently works on older browsers as well). This makes your HTML smaller and cleaner, and makes it easier to optionally swap out or customize JS libraries.  The Validation helpers in ASP.NET MVC 3 also now use the jQueryValidate plugin by default.</p></blockquote>
<p>Basically we get all the validation done by loading js function parsing loaded DOM searching for specific parameters based on which validation rules are applied to elements. And all of that without a single js line from &#8216;our&#8217; &#8211; web developers side.</p>
<p>One thing is not obvious though and it certainly needs extra explanation: what happens after part of the page is loaded via Ajax request (common Partial View result). Validation is not turned for those elements although all attributes are correctly marked. I have dig a little and found within JavaScript file &#8216;jquery.validate.unobtrusive.js&#8217; function: jQuery.validator.unobtrusive.parse(selector). Calling function after new content is loaded solves problem, like in the example below:</p>
<pre class="brush: jscript; title: ; notranslate">

$.post(&quot;test/updateCustomer&quot;, { name: &quot;Mark&quot;, surname: &quot;Barker&quot; },
  function(htmlContent){
    $('#container').html(htmlContent);
    jQuery.validator.unobtrusive.parse('#content')
  }
);
</pre>
<p>Hope it helps someone&#8230;</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fitmeze.com%2F2010%2F10%2F08%2Fclient-side-validation-after-ajax-partial-view-result-in-asp-net-mvc-3%2F&amp;title=Client%20side%20validation%20after%20Ajax%20Partial%20View%20result%20in%20ASP.NET%20MVC%203" id="wpa2a_4"><img src="http://itmeze.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>Related posts:<ol>
<li><a href='http://itmeze.com/2010/12/06/checkbox-has-to-be-checked-with-unobtrusive-jquery-validation-and-asp-net-mvc-3/' rel='bookmark' title='Checkbox has to be &#8216;checked&#8217; &#8211; with unobtrusive jQuery validation and ASP.NET MVC 3'>Checkbox has to be &#8216;checked&#8217; &#8211; with unobtrusive jQuery validation and ASP.NET MVC 3</a></li>
<li><a href='http://itmeze.com/2009/08/13/tips-for-jquery-validation-plugin/' rel='bookmark' title='Tips for jQuery validation plugin'>Tips for jQuery validation plugin</a></li>
<li><a href='http://itmeze.com/2011/03/21/javascript-encode-on-server-side-medium-trust-environment/' rel='bookmark' title='Javascript Encode on server side &#8211; Medium Trust Environment'>Javascript Encode on server side &#8211; Medium Trust Environment</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://itmeze.com/2010/10/08/client-side-validation-after-ajax-partial-view-result-in-asp-net-mvc-3/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Tips for jQuery validation plugin</title>
		<link>http://itmeze.com/2009/08/13/tips-for-jquery-validation-plugin/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=tips-for-jquery-validation-plugin</link>
		<comments>http://itmeze.com/2009/08/13/tips-for-jquery-validation-plugin/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 12:18:41 +0000</pubDate>
		<dc:creator>ITmeze</dc:creator>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[validation]]></category>

		<guid isPermaLink="false">http://itmeze.com/?p=80</guid>
		<description><![CDATA[Because I currently work with a couple of projects where I extensively use jQuery framework, together with it&#8217;s plugins I decided to write a post in which I can gather all of my ideas, tips that i have arrived during my work with this library.  I am a kind of guy that has a huge [...]
Related posts:<ol>
<li><a href='http://itmeze.com/2010/10/08/client-side-validation-after-ajax-partial-view-result-in-asp-net-mvc-3/' rel='bookmark' title='Client side validation after Ajax Partial View result in ASP.NET MVC 3'>Client side validation after Ajax Partial View result in ASP.NET MVC 3</a></li>
<li><a href='http://itmeze.com/2010/12/06/checkbox-has-to-be-checked-with-unobtrusive-jquery-validation-and-asp-net-mvc-3/' rel='bookmark' title='Checkbox has to be &#8216;checked&#8217; &#8211; with unobtrusive jQuery validation and ASP.NET MVC 3'>Checkbox has to be &#8216;checked&#8217; &#8211; with unobtrusive jQuery validation and ASP.NET MVC 3</a></li>
<li><a href='http://itmeze.com/2009/07/21/firefox-3-0-411-length-required-with-jquery/' rel='bookmark' title='Firefox 3.0: 411 Length required with JQuery'>Firefox 3.0: 411 Length required with JQuery</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-7051816622200841";
google_ad_slot = "0915606426";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<br />
Because I currently work with a couple of projects where I extensively use jQuery framework, together with it&#8217;s plugins I decided to write a post in which I can gather all of my ideas, tips that i have arrived during my work with this library.  I am a kind of guy that has a huge mess not only on his computer&#8217;s desktop but even within project files. It happens that when I arrive a problem, and I am sure I have figured it out in some other project but it usually takes me ages to dig through all of them to find even simplest solution. That is why I decided that I really need a place for all my tips and tricks, so I can find them easily.</p>
<p>This post focuses on jQuery Validation plugin, as i think this is the second thing i add to my project &#8211; after jQuery core file <img src='http://itmeze.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . I will add more and more tips from time to time as soon as I find something worth to write down.</p>
<p>Ever worked with one of most popular <a title="jQuery Validation plugin" href="http://docs.jquery.com/Plugins/Validation" target="_blank">jQuery validation plugins</a>? This is extremely powerful and yet flexible plug-in that  makes form validation in javascript really easy.</p>
<p>Beside that fact that it already contains most popular validation rules, like checking field length, validating email or url format, it enables you to write your own &#8220;rule&#8221;.</p>
<h3>1. Adding new method</h3>
<p>Plugin supports method called &#8216;equalTo&#8217;. It is widely used &#8211; especially we request password confirmation. What is not supported is &#8216;notEqualTo&#8217; method. Not that popular but can be useful from time to time.  Let us say we have a field that needs to be different from other field, like new password has to be different than old password &#8211; maybe not the best choice but draws the picture.. OK, I guess recommended way to do that would be to add new method to jQuery validation plugin:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">  jQuery.<span style="color: #660066;">validator</span>.<span style="color: #660066;">addMethod</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;notEqualTo&quot;</span><span style="color: #339933;">,</span>
                             <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>value<span style="color: #339933;">,</span> element<span style="color: #339933;">,</span> param<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                                  <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">optional</span><span style="color: #009900;">&#40;</span>element<span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> value <span style="color: #339933;">!=</span> $<span style="color: #009900;">&#40;</span>param<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: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;This has to be different...&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#change-password-form&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">validate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
                rules<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span> ... <span style="color: #660066;">newPassword</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span> notEqualTo<span style="color: #339933;">:</span><span style="color: #3366CC;">'#currentPassword'</span> <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
                messages<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span> newPassword<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span> notEqualTo<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;New password has to be different than old one&quot;</span> <span style="color: #009900;">&#125;</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>

<h3>2. Preventing double form submission</h3>
<p>Another common issue every web developer arrives sooner or later is so called &#8216;double form submit&#8217;. Or going further on &#8216;multiple form submit&#8217;. It happens when user accidentally presses submit button couple of times, causing form to be send multiple times. If we have validation plugin for our form we can make use of submitHandler method to disable button after form is submitted.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">  $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#sample-form&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">validate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
                submitHandler<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>form<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><span style="color: #339933;">!</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">wasSent</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">wasSent</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
                        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">':submit'</span><span style="color: #339933;">,</span> form<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Please wait...'</span><span style="color: #009900;">&#41;</span>
                                          .<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'disabled'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'disabled'</span><span style="color: #009900;">&#41;</span>
                                          .<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'disabled'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        form.<span style="color: #660066;">submit</span><span style="color: #009900;">&#40;</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: #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;">&#125;</span>
            <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>3. Turning on/off validation under certain conditions</h3>
<p>It happens quite often that we require input in certain field only when some other element is selected. I just finished making web page that allows users to subscribe to newsletters on their request.  If user selects certain check-box &#8211; it means he want to subscribe and we require from him to put valid email in other field.<br />
Otherwise, we want to keep validation turned off. To do this, we use :</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;label for=&quot;cbxSubscribe&quot;&gt; Would you like to subscribe?&lt;/label&gt;
&lt;input id=&quot;cbxSubscribe&quot; type=&quot;checkbox&quot; /&gt;
&lt;input id=&quot;txtSubscriptionEmail&quot; name=&quot;subemail&quot; /&gt;</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#sample-form&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">validate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
  rules<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
    txtSubscriptionEmail<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
      required<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;#cbxSubscribe:checked&quot;</span>
    <span style="color: #009900;">&#125;</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>As simple as that. Element &#8216;txtSubscriptionEmail&#8217; is required depending on evaluation of &#8216;#cbxSubscribe:checked&#8217; expression.</p>
<h3>4. Use CDN from Microsoft AJAX</h3>
<p>Surprise, Surprise! ASP.NET MVC 2 (since preview 2 i guess ) includes jQuery validation plugin to provide client side validation. Definitely good news!</p>
<p>Moreover, Microsoft now provides CDN for plugin:<a href="http://ajax.microsoft.com/ajax/jquery.validate/1.5.5/jquery.validate.js"></a></p>
<ul>
<li><a href="http://ajax.microsoft.com/ajax/jquery.validate/1.5.5/jquery.validate.js">http://ajax.microsoft.com/ajax/jquery.validate/1.5.5/jquery.validate.js</a></li>
<li><a href="http://ajax.microsoft.com/ajax/jquery.validate/1.5.5/jquery.validate.min.js">http://ajax.microsoft.com/ajax/jquery.validate/1.5.5/jquery.validate.min.js</a></li>
</ul>
<p>As well as documentation for visual studio &#8211; this would allow IntelliSense to work under visual studio (2008 and up):</p>
<ul>
<li><a href="http://ajax.microsoft.com/ajax/jquery.validate/1.5.5/jquery.validate-vsdoc.js">http://ajax.microsoft.com/ajax/jquery.validate/1.5.5/jquery.validate-vsdoc.js</a></li>
</ul>
<p>You should make use of CDN wherever possible. It saves you bandwidth, most probably Microsoft serves content faster and there is always a chance your visitors will have it cached already. Note that Google offers CDN for jQuery and some other libraries: <a title="google cdn" href="http://code.google.com/apis/ajaxlibs/" target="_blank">Google AJAX libraries API</a>.</p>
<p>Stay tuned for more updates&#8230;.</p>
<p>I will keep on adding more tips in future.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fitmeze.com%2F2009%2F08%2F13%2Ftips-for-jquery-validation-plugin%2F&amp;title=Tips%20for%20jQuery%20validation%20plugin" id="wpa2a_6"><img src="http://itmeze.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>Related posts:<ol>
<li><a href='http://itmeze.com/2010/10/08/client-side-validation-after-ajax-partial-view-result-in-asp-net-mvc-3/' rel='bookmark' title='Client side validation after Ajax Partial View result in ASP.NET MVC 3'>Client side validation after Ajax Partial View result in ASP.NET MVC 3</a></li>
<li><a href='http://itmeze.com/2010/12/06/checkbox-has-to-be-checked-with-unobtrusive-jquery-validation-and-asp-net-mvc-3/' rel='bookmark' title='Checkbox has to be &#8216;checked&#8217; &#8211; with unobtrusive jQuery validation and ASP.NET MVC 3'>Checkbox has to be &#8216;checked&#8217; &#8211; with unobtrusive jQuery validation and ASP.NET MVC 3</a></li>
<li><a href='http://itmeze.com/2009/07/21/firefox-3-0-411-length-required-with-jquery/' rel='bookmark' title='Firefox 3.0: 411 Length required with JQuery'>Firefox 3.0: 411 Length required with JQuery</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://itmeze.com/2009/08/13/tips-for-jquery-validation-plugin/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Firefox 3.0: 411 Length required with JQuery</title>
		<link>http://itmeze.com/2009/07/21/firefox-3-0-411-length-required-with-jquery/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=firefox-3-0-411-length-required-with-jquery</link>
		<comments>http://itmeze.com/2009/07/21/firefox-3-0-411-length-required-with-jquery/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 11:17:08 +0000</pubDate>
		<dc:creator>ITmeze</dc:creator>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://itmeze.com/?p=53</guid>
		<description><![CDATA[I am currently working on a small project for my own. My favourite (and the only one tester) was complaining on some of &#8220;ajax&#8221; features. Tests were done with use of Firefox 3.0 &#8211; I was developing on Firefox 3.5 and had absolutely no problems with those problematic features. Anyway I decided to check this [...]
Related posts:<ol>
<li><a href='http://itmeze.com/2010/10/10/debugging-silverlight-in-firefox-and-chrome/' rel='bookmark' title='Debugging silverlight in Firefox and Chrome'>Debugging silverlight in Firefox and Chrome</a></li>
<li><a href='http://itmeze.com/2010/10/09/google-chrome-has-finally-become-my-first-browser/' rel='bookmark' title='Google Chrome has finally become my first browser!'>Google Chrome has finally become my first browser!</a></li>
<li><a href='http://itmeze.com/2009/08/13/tips-for-jquery-validation-plugin/' rel='bookmark' title='Tips for jQuery validation plugin'>Tips for jQuery validation plugin</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-7051816622200841";
google_ad_slot = "0915606426";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
<p>I am currently working on a small project for my own. My favourite (and the only one tester) was  complaining on some of &#8220;ajax&#8221; features. Tests were done with use of Firefox 3.0  &#8211; I was developing on Firefox 3.5 and had absolutely no problems with those problematic features. Anyway I decided to check this out an downloaded 3.0 version ( most recent is 3.0.11). You can have multiple instances of Firefox on Your machine &#8211; just make sure You install them in separate directories. Then the best would be to create different user profiles &#8211; like one default and one for testing. You can manage profiles using :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">firefox.exe -ProfileManager</pre></div></div>

<p>And then You can run prev version by:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">\path\Firefox 3.0\firefox.exe -P test_profile -no-remote</pre></div></div>

<p>Having this set up You can test in Firefox 3.0. I was able to reproduce error and check what is going on in firebug.<br />
I was receiving HTTP 411 error, which says:</p>
<blockquote><p>Your Web server thinks that the HTTP data stream sent by the client (e.g. your Web browser or our CheckUpDown robot) should include a &#8216;Content-Length&#8217; specification. This is typically used only for HTTP methods that result in the placement of data on the Web server, not the retrieval of data from it.</p></blockquote>
<p>It looks like jQuery (1.3.2) ajax calls with data parameter set to &#8216;null&#8217; was causing this to happen.</p>
<p>Simple solution for me was to set &#8216;{}&#8217; as data parameter value instead of &#8216;null&#8217;. Moreover, You can change method that I already mentioned about, <a title="jsonPOST with jQuery" href="http://itmeze.com/2009/06/postjson-how-to-avoid-json-attack/" target="_blank">postJSON</a> with this fix:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">postJSON</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>url<span style="color: #339933;">,</span> data<span style="color: #339933;">,</span> callback<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>data <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
         data <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
     $.<span style="color: #660066;">post</span><span style="color: #009900;">&#40;</span>url<span style="color: #339933;">,</span> data<span style="color: #339933;">,</span> callback<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;json&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div>

<p>BTW I already use Firefox 3.5 during development &#8211; it consumes less resources than previous versions () so I strongly recommend upgrading to newest version.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fitmeze.com%2F2009%2F07%2F21%2Ffirefox-3-0-411-length-required-with-jquery%2F&amp;title=Firefox%203.0%3A%20411%20Length%20required%20with%20JQuery" id="wpa2a_8"><img src="http://itmeze.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>Related posts:<ol>
<li><a href='http://itmeze.com/2010/10/10/debugging-silverlight-in-firefox-and-chrome/' rel='bookmark' title='Debugging silverlight in Firefox and Chrome'>Debugging silverlight in Firefox and Chrome</a></li>
<li><a href='http://itmeze.com/2010/10/09/google-chrome-has-finally-become-my-first-browser/' rel='bookmark' title='Google Chrome has finally become my first browser!'>Google Chrome has finally become my first browser!</a></li>
<li><a href='http://itmeze.com/2009/08/13/tips-for-jquery-validation-plugin/' rel='bookmark' title='Tips for jQuery validation plugin'>Tips for jQuery validation plugin</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://itmeze.com/2009/07/21/firefox-3-0-411-length-required-with-jquery/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

