[Proto-Scripty] using eval inside Ajax Request
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); } } ); } --~--~-~--~~~---~--~~ 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
Interesting, I've never done that before. What about this: eval("someVar=function() { this.elm=$('getElm'); this.elm.innerHTML='test'; };"); alert($('getElm').innerHTML); --~--~-~--~~~---~--~~ 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
Sorry, should be: eval("someVar=function() { this.elm=$('outputs');}; s=new someVar(); s.innerHTML='test';"); alert($('outputs').innerHTML); // not 'test' --~--~-~--~~~---~--~~ 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
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? --~--~-~--~~~---~--~~ 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] Autocompleter.DB
I want to create an autocompleter that uses HTML database storage. What I'm intending to it modify Autocompleter.Local. My problem is that I'm not sure how to fit these 2 pieces of code together: >From Autocompleter: getUpdatedChoices: function() { this.updateChoices(this.options.selector(this), searchDB (this.getToken())); } DB function: function searchDB(searchThis) { db.transaction(function(tx) { tx.executeSql(" SELECT info FROM list WHERE (FirstName LIKE ? OR LastName LIKE ?) ORDER BY LastName LIMIT 20", [searchThis+'%', searchThis+'%'], function(tx, result){ // success, but how do I get result to my other function? } , function(tx, error) { alert('Failed to retrieve notes from database - ' + error.message); return; }); }); } --~--~-~--~~~---~--~~ 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 prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Ajax.Responders
I seem to have a problem with my code. I won't post all of it here, but when use this: Ajax.Responders.register( { onCreate: function() { if($('loading') && Ajax.activeRequestCount>0) { Effect.Appear('loading',{duration: .5, queue: 'end'}); $('loading').update('Loading ('+Ajax.activeRequestCount +')...'); } }, onComplete: function() { if($('loading') && Ajax.activeRequestCount==0) { Effect.Fade('loading',{duration: .5, queue: 'end'}); $('loading').update('Loading ('+Ajax.activeRequestCount +')...'); } } } ); after the first set of Ajax calls it seems to get stuck and only increments, does not deduct. (So my loading screen doesn't go away.) Any ideas what I could be doing wrong? I have many Ajax calls, but the site seems to be working as expected so I know the data did load. --~--~-~--~~~---~--~~ 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: Ajax.Responders
Thanks for the optimizations. I think the problem is elsewhere though No browser errors. I'm on the latest WebKit. On Oct 7, 2:05 pm, "Justin Perkins" <[EMAIL PROTECTED]> wrote: > Are you getting any errors? What browser are you using? > > I think that code can be cleaned up a bit, $() is expensive, it should > be used sparingly. Also there is no need to call appear on an already > visible element. > > Ajax.Responders.register({ > onCreate: function(request){ > var loading = $('loading'); > if (loading){ > loading.update('Loading (' + Ajax.activeRequestCount + ')') > // only appear the element if it is not already visible > if (!loading.visible()) loading.appear({duration:0.5}); > } > }, > onComplete: function(request){ > var loading = $('loading'); > if (loading){ > loading.update('Loading (' + Ajax.activeRequestCount + ')'); > if (loading.visible() && Ajax.activeRequestCount < 1) > loading.fade({duration:0.5}); > } > } > > > > }); --~--~-~--~~~---~--~~ 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: Ajax.Responders
WebKit has a JS debugger much like Firebug, no errors. Here's the function I call that seems to no decrement the counter: function saveAllCEs() { $A(document.getElementsByClassName("editable")).each( function(ce){ new Ajax.Updater({ failure: $('evalMsgs') }, '/aa/saveHTML.html', { parameters: { RxN: gRxN, id: ce.id, HTML: $(ce).innerHTML }, insertion: 'after', onComplete: function(){return true;} }); } ); } On Oct 7, 2:45 pm, Namotco <[EMAIL PROTECTED]> wrote: > Thanks for the optimizations. I think the problem is elsewhere > though No browser errors. I'm on the latest WebKit. > > On Oct 7, 2:05 pm, "Justin Perkins" <[EMAIL PROTECTED]> wrote: > > > > > Are you getting any errors? What browser are you using? > > > I think that code can be cleaned up a bit, $() is expensive, it should > > be used sparingly. Also there is no need to call appear on an already > > visible element. > > > Ajax.Responders.register({ > > onCreate: function(request){ > > var loading = $('loading'); > > if (loading){ > > loading.update('Loading (' + Ajax.activeRequestCount + ')') > > // only appear the element if it is not already visible > > if (!loading.visible()) loading.appear({duration:0.5}); > > } > > }, > > onComplete: function(request){ > > var loading = $('loading'); > > if (loading){ > > loading.update('Loading (' + Ajax.activeRequestCount + ')'); > > if (loading.visible() && Ajax.activeRequestCount < 1) > > loading.fade({duration:0.5}); > > } > > } > > > }); --~--~-~--~~~---~--~~ 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: Ajax.Responders
My error was not having the success in Ajax.Updater. I didn't want one, but it is required... Thanks! On Oct 7, 2:56 pm, "Justin Perkins" <[EMAIL PROTECTED]> wrote: > On Tue, Oct 7, 2008 at 2:50 PM, Namotco <[EMAIL PROTECTED]> wrote: > > > WebKit has a JS debugger much like Firebug, no errors. > > I know, but I still find Firebug to be much better about error reporting. > > > Here's the > > function I call that seems to no decrement the counter: > > If there is an error in that code that causes the Ajax request to > fail, it will not invoke the onComplete global callback. > > -justin --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---