Welcome to WebmasterWorld Guest from 23.20.238.193

Forum Moderators: open

Message Too Old, No Replies

Passing a var to another func?

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

WebmasterWorld Senior Member 10+ Year Member



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!

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

5+ Year Member



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]

 

Featured Threads

Hot Threads This Week

Hot Threads This Month