<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
	>
<channel>
	<title>Comments on: Passing parameters to a function called with setTimeout</title>
	<atom:link href="http://www.makemineatriple.com/2007/10/passing-parameters-to-a-function-called-with-settimout/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.makemineatriple.com/2007/10/passing-parameters-to-a-function-called-with-settimout/</link>
	<description></description>
	<pubDate>Sun, 14 Mar 2010 11:50:14 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: hendry</title>
		<link>http://www.makemineatriple.com/2007/10/passing-parameters-to-a-function-called-with-settimout/comment-page-1/#comment-330</link>
		<dc:creator>hendry</dc:creator>
		<pubDate>Wed, 09 Sep 2009 17:58:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.makemineatriple.com/2007/10/passing-parameters-to-a-function-called-with-settimout/#comment-330</guid>
		<description>You saved my life.. :)</description>
		<content:encoded><![CDATA[<p>You saved my life.. <img src='http://www.makemineatriple.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: calvin</title>
		<link>http://www.makemineatriple.com/2007/10/passing-parameters-to-a-function-called-with-settimout/comment-page-1/#comment-329</link>
		<dc:creator>calvin</dc:creator>
		<pubDate>Sat, 15 Aug 2009 05:01:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.makemineatriple.com/2007/10/passing-parameters-to-a-function-called-with-settimout/#comment-329</guid>
		<description>WOOOWWWWWW. I HAVE SPENT AT LEAST 4 HOURS ON THIS PROBLEM! Thanks so much!</description>
		<content:encoded><![CDATA[<p>WOOOWWWWWW. I HAVE SPENT AT LEAST 4 HOURS ON THIS PROBLEM! Thanks so much!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy</title>
		<link>http://www.makemineatriple.com/2007/10/passing-parameters-to-a-function-called-with-settimout/comment-page-1/#comment-328</link>
		<dc:creator>Andy</dc:creator>
		<pubDate>Sat, 08 Aug 2009 19:40:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.makemineatriple.com/2007/10/passing-parameters-to-a-function-called-with-settimout/#comment-328</guid>
		<description>Thanks this was a great help.</description>
		<content:encoded><![CDATA[<p>Thanks this was a great help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam Hill</title>
		<link>http://www.makemineatriple.com/2007/10/passing-parameters-to-a-function-called-with-settimout/comment-page-1/#comment-325</link>
		<dc:creator>Sam Hill</dc:creator>
		<pubDate>Tue, 30 Jun 2009 19:17:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.makemineatriple.com/2007/10/passing-parameters-to-a-function-called-with-settimout/#comment-325</guid>
		<description>Thank you this helped solve a three day problem. As a note if you need to use the keyword 'this' it still doesnt work in the closure, you have to create a variable reference to 'this' (eg. var myThis = this;). Thanks again</description>
		<content:encoded><![CDATA[<p>Thank you this helped solve a three day problem. As a note if you need to use the keyword &#8216;this&#8217; it still doesnt work in the closure, you have to create a variable reference to &#8216;this&#8217; (eg. var myThis = this;). Thanks again</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bryan</title>
		<link>http://www.makemineatriple.com/2007/10/passing-parameters-to-a-function-called-with-settimout/comment-page-1/#comment-321</link>
		<dc:creator>bryan</dc:creator>
		<pubDate>Wed, 03 Jun 2009 21:11:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.makemineatriple.com/2007/10/passing-parameters-to-a-function-called-with-settimout/#comment-321</guid>
		<description>@gazhay - you've misread my comment:

I declared that the code posted *didn't* work (in response to Rick - comment 22), but that using my commented-out line *does* work.</description>
		<content:encoded><![CDATA[<p>@gazhay - you&#8217;ve misread my comment:</p>
<p>I declared that the code posted *didn&#8217;t* work (in response to Rick - comment 22), but that using my commented-out line *does* work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gazhay</title>
		<link>http://www.makemineatriple.com/2007/10/passing-parameters-to-a-function-called-with-settimout/comment-page-1/#comment-320</link>
		<dc:creator>gazhay</dc:creator>
		<pubDate>Mon, 01 Jun 2009 16:25:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.makemineatriple.com/2007/10/passing-parameters-to-a-function-called-with-settimout/#comment-320</guid>
		<description>@23 Bryan,

That code is never going to work because you have not written it correctly.

Look at setTimeout("test("+p1+")", 400);
expand it yourself and you get

setTimeout( test(one), 400);

test(one) is not valid syntax - unless one is defined as a variable - which it is not.

You probably meant setTimeout("test(' "+p1+" ')", 400);
Where there are some extra quotes to yield test('one').

Even then, it probably doesn't do what you expect.</description>
		<content:encoded><![CDATA[<p>@23 Bryan,</p>
<p>That code is never going to work because you have not written it correctly.</p>
<p>Look at setTimeout(&#8221;test(&#8221;+p1+&#8221;)&#8221;, 400);<br />
expand it yourself and you get</p>
<p>setTimeout( test(one), 400);</p>
<p>test(one) is not valid syntax - unless one is defined as a variable - which it is not.</p>
<p>You probably meant setTimeout(&#8221;test(&#8217; &#8220;+p1+&#8221; &#8216;)&#8221;, 400);<br />
Where there are some extra quotes to yield test(&#8217;one&#8217;).</p>
<p>Even then, it probably doesn&#8217;t do what you expect.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.makemineatriple.com/2007/10/passing-parameters-to-a-function-called-with-settimout/comment-page-1/#comment-312</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Fri, 10 Apr 2009 05:15:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.makemineatriple.com/2007/10/passing-parameters-to-a-function-called-with-settimout/#comment-312</guid>
		<description>Finally! OMG! Thanks!</description>
		<content:encoded><![CDATA[<p>Finally! OMG! Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BladeMcCool</title>
		<link>http://www.makemineatriple.com/2007/10/passing-parameters-to-a-function-called-with-settimout/comment-page-1/#comment-311</link>
		<dc:creator>BladeMcCool</dc:creator>
		<pubDate>Thu, 09 Apr 2009 20:39:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.makemineatriple.com/2007/10/passing-parameters-to-a-function-called-with-settimout/#comment-311</guid>
		<description>You are top result for this google query:

javascript pass parameters to setTimeout

... THANK YOU for being top result!

Funny enough I'd done what you did but wasnt sure why it was working, and was looking for the "proper" way to do it... I guess this was the proper way!</description>
		<content:encoded><![CDATA[<p>You are top result for this google query:</p>
<p>javascript pass parameters to setTimeout</p>
<p>&#8230; THANK YOU for being top result!</p>
<p>Funny enough I&#8217;d done what you did but wasnt sure why it was working, and was looking for the &#8220;proper&#8221; way to do it&#8230; I guess this was the proper way!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cowboydan</title>
		<link>http://www.makemineatriple.com/2007/10/passing-parameters-to-a-function-called-with-settimout/comment-page-1/#comment-309</link>
		<dc:creator>Cowboydan</dc:creator>
		<pubDate>Tue, 07 Apr 2009 23:28:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.makemineatriple.com/2007/10/passing-parameters-to-a-function-called-with-settimout/#comment-309</guid>
		<description>Thanks a bunch partner. I had been searching for this for a couple of hours. Whoa, got to git back to the ranch.</description>
		<content:encoded><![CDATA[<p>Thanks a bunch partner. I had been searching for this for a couple of hours. Whoa, got to git back to the ranch.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bryan</title>
		<link>http://www.makemineatriple.com/2007/10/passing-parameters-to-a-function-called-with-settimout/comment-page-1/#comment-298</link>
		<dc:creator>bryan</dc:creator>
		<pubDate>Sat, 28 Mar 2009 04:38:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.makemineatriple.com/2007/10/passing-parameters-to-a-function-called-with-settimout/#comment-298</guid>
		<description>@Rick,

Maybe I've misread something, but the following code doesn't work, while the commented-out line, which uses the closure, is fine:
&lt;code&gt;
    $(document).ready(function() {
        var p1 = 'one';
        var p2 = 'two';
        //setTimeout(function(){test(p1,p2);},400);
        setTimeout("test("+p1+")", 400);
    });
    
    function test(param,param2) {
        alert(param);
        alert(param2);
    }
&lt;/code&gt;

I'd suggest that, any other considerations aside, the closure approach is more manageable syntax, particularly where several parameters are needed.

Bryan</description>
		<content:encoded><![CDATA[<p>@Rick,</p>
<p>Maybe I&#8217;ve misread something, but the following code doesn&#8217;t work, while the commented-out line, which uses the closure, is fine:<br />
<code><br />
    $(document).ready(function() {<br />
        var p1 = 'one';<br />
        var p2 = 'two';<br />
        //setTimeout(function(){test(p1,p2);},400);<br />
        setTimeout("test("+p1+")", 400);<br />
    });</p>
<p>    function test(param,param2) {<br />
        alert(param);<br />
        alert(param2);<br />
    }<br />
</code></p>
<p>I&#8217;d suggest that, any other considerations aside, the closure approach is more manageable syntax, particularly where several parameters are needed.</p>
<p>Bryan</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.737 seconds -->
