<div id="newTable">NUMBERS</div><script type="text/javascript">function loadScript() {new Ajax.Updater('newTable', 'generateNumbers.js', { method: 'get' , evalScripts: true });}</script><form action=""><input type="button" id="resetButton" value="Refresh Table" onclick="loadScript();"/>In the external js file i have the following<script type="text/javascript">alert("Hello");</script>The result is that the button clears the div, and doesn't populate it with the contents of the javascript, it ends up being empty.Any tips would be greatly appreciated.Thanks,jim
Try using the onsuccess on failure parameters in Ajax updater.
onFailure: function() {alert("bombed");},
onSuccess: ...
If it helps, I can replace the js with something real simple (an alert) and it still won't run in the AJAX page. If I put plain text or html or php in the external file it will run, but not javascript.
On Thursday, July 26, 2012 12:22:54 PM UTC-4, Jim Longo wrote:Hi, I'm very new to this so excuse my ignorance.I've simplified this, but basically I have a function in an external js file that I want to be able to re-run from my page using AJAX.UpdaterSo in my html page I have the following section. A div I want to replace, a function containing the Updater that I want to run from the button.
<div id="newTable">NUMBERS</div><script type="text/javascript">function loadScript() {new Ajax.Updater('newTable', 'generateNumbers.js', { method: 'get' , evalScripts: 'true' });}</script><form action=""><input type="button" id="resetButton" value="Refresh Table" onclick="loadScript();"/>In the external js file i have the following
<script type="text/javascript">alert("Hello");</script>
--
You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group.
To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/J37qs3VY54cJ.
To post to this group, send email to prototype-s...@googlegroups.com.
To unsubscribe from this group, send email to prototype-scripta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
Try using the onsuccess on failure parameters in Ajax updater.
onFailure: function() {alert("bombed");},
onSuccess: ...
--
You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group.
To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/3bfU0S4hsnQJ.
then perhaps we're not understanding what you mean by "passed"normal process is:onSuccess: call a function that processes the incoming dataonFailure: tell the user what happenedwhat gets "passed" is data.what gets "called" are functions.having code in an external file indicates to me you want to call a function.I think a little more clarity might help us help you.
--
You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group.
To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/-2gPjjF2osEJ.
Philsetting the content of an element via the innerHTML property was deprecated for the $("elmentid").update(content) function. Or by using the $("elmentid").insert(content) function if appropriate.
P.S. The reason I haven't tried Jason's code yet, was there were too many elements in there that I didn't understand at all, and I'm loathe to open any more wormholes. But I'll take another look at it.
Don't worry about that wall, I've already got a nice soft dent in it!
--
You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group.
To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/DdzCL1yvk7oJ.
Here is the page being called . . .<script type="text/javascript">sayHi = function(){alert ('Hi');};</script><input type="button" value="Click Me" onclick="sayHi()"/>
My problem is that if I replace alert with document.write then the page gets replaced with a new page. I thought the idea behind AJAX.Updater was to replace the DIV with new data, or in this case the result of the function. So in my newbie logic the DIV should get replaced with the text generated by document.write.?