Hi, > if (http_request.readyState == 4) { > if (http_request.status == 200) { > document.getElementById('load').innerHTML = > "";
You're not using Ajax.Request[1] or Ajax.Updater[2]? > This is my onSuccess handler, how do > I apply evalScripts? DJ and I are talking about a Prototye onSuccess handler for one of the two features above. > document.getElementById(div).innerHTML = thereturn; Your code is setting the innerHTML property directly. If you just change that line to use Element#update instead, #update will handle eval'ing the scripts for you: $(div).update(thereturn); Altenately, keep setting innerHTML directly (although #update does some very handy things for you) and then after doing that, call String#evalScripts() directly: document.getElementById(div).innerHTML = thereturn; thereturn.evalScripts(); String#evalScripts is a method Prototype adds to the String prototype and so it's available on all strings. Details here.[4] Looking at your quoted code, you're not making much use of Prototype at all -- not even the $() function! (So much more compact than document.getElementById.) I suggest taking an hour to read through the API docs[5] front-to-back to get an idea of what's on offer. It literally takes an hour and saves you no end of time in the long run. May also be worth reading through some stuff on the unofficial wiki [6]. [1] http://prototypejs.org/api/ajax/request [2] http://prototypejs.org/api/ajax/updater [3] http://prototypejs.org/api/element/update [4] http://prototypejs.org/api/string/evalScripts [5] http://prototypejs.org/api [6] http://proto-scripty.wikidot.com/ HTH, -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Aug 4, 1:22 am, Drum <csteph2...@gmail.com> wrote: > > if you need to do it yourself, you'd use > > String#evalScripts on the responseText member of the Ajax.Response > > passed into your onSuccess handler. > > Sorry, I still don't understand. This is my onSuccess handler, how do > I apply evalScripts? > > if (http_request.readyState == 4) { > if (http_request.status == 200) { > document.getElementById('load').innerHTML = > ""; > var thereturn = http_request.responseText; > document.getElementById(div).innerHTML = > thereturn; > } else { > alert(error); > } > } --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---