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.Updater

So 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
window.pickNumbers = function (){

var lottoArray = new Array();
var size=10;
var i=0;
while (i<size)
{
lottoArray[i]  = getLottoNumber();

for (j=0 ; j<i ; j++)
{
if (lottoArray[i] == lottoArray[j])
{
document.write ("\u211B ");
i-- ;
break;
}
}
i++;
}

document.write ("<table border = '2'><tr>"); 
for (var i=0 ; i<size ; i++)
{
document.write ("<TD width='40'>" + lottoArray[i] + "</TD>");
}
document.write ("</tr></table>"); 
} 

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

-- 
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/-/xuDibXgV0rEJ.
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.

Reply via email to