[Proto-Scripty] Re: using eval inside Ajax Request

2008-11-15 Thread kangax

On Nov 15, 10:26 pm, Namotco [EMAIL PROTECTED] wrote:
 I was trying to demonstrate my problem, it's not what's actually in my
 code.  It's seems that $('test') inside my eval is not the same as the
 $('test') outside of it.  When I try to run that code I'd expect $
 ('test')'s HTML to change, but it doesn't.  Why not and how can I make
 it do that?

Does something like this work?
eval('(function(el){ if (el = $(test)) { el.innerHTML = test } })
();');

--
kangax
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: using eval inside Ajax Request

2008-11-14 Thread kangax

On Nov 14, 7:03 pm, Namotco [EMAIL PROTECTED] wrote:
 Sorry, should be:

 eval(someVar=function() {     this.elm=$('outputs');    }; s=new
 someVar(); s.innerHTML='test';);

Omitting `var` is generally a bad idea. Either use `var` or assign to
a property directly (as in `window.foo = 'bar'`);

 alert($('outputs').innerHTML);

  // not 'test'

I'm not sure what this is supposed to do. You create an object (via
`new`) with `elm` property (referencing some element) and then assign
'test' to `innerHTML` property of that object. Why? : )

--
kangax
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: using eval inside Ajax Request

2008-11-12 Thread kangax

On Nov 12, 4:37 pm, Namotco [EMAIL PROTECTED] wrote:
 Maybe this evals, but the functions do not get exposed.  How should I
 be doing this?

 function reCalc() {
         var sendSymsN = new Ajax.Request(url, {method:'post', onSuccess:
 function() {
                                 var evalMe=decode(transport.responseText); // 
 returns
 ( fname = function() { doStuff; }
                                 eval(ev);
                                 }
                         }
 );

 }

Change server response from:

`fname = function(){ doStuff; }`

to:

`window.fname = function(){ doStuff; }`

--
kangax
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---