In AJAX, I need to return several javascript functions which are called by event handlers in the http response. However, I cannot get those javascript functions evaluated by the browser.
For example, if server returns the following for an AJAX request:
<script>
function foo()
{
}
<script>
<form>
<input type='button' value='test' onclick='foo()'> </form>
I can see the 'test' button, but when I click it, I got error: "foo() not defined".
I searched on google and found people suggested using eval(), but that doesn't work for function either.
For example, if server returns the following for an AJAX request:
<script>
function foo()
{
}
<script>
<form>
<input type='button' value='test' onclick='foo()'> </form>
I can see the 'test' button, but when I click it, I got error: "foo() not defined".
I searched on google and found people suggested using eval(), but that doesn't work for function either.