homepage Welcome to WebmasterWorld Guest from 54.198.139.141
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Passing a var to another func?
ahmedtheking




msg:3478765
 12:45 pm on Oct 16, 2007 (gmt 0)

I've got this:

function foo (a) {
var bar = arguements[1];
new Ajax.Request('foo/bar/site',{
method: 'get',
onSuccess: function (r) {
if (bar) { ... }
}
});
}

Now, I can't for the life of me figure out how to get 'bar' within the onSuccess function to work. I hope that makes sense!

 

HOTmike




msg:3491076
 2:22 am on Oct 30, 2007 (gmt 0)

At a glance, I'd suggest this little edit:

instead of:
function foo (a) {
var bar = arguements[1];

do this:
function foo (a) {
var bar = arguments[0];

I assume "arguements" was a typo, but you definitely need to access the first value of the arguments, beginning with arguments[0]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved