Function definition inside script in remote call

I’m using remote request to update a div with a table. At the end of
the table I have some javascript where I define a function

start table.rhtml


end table.rhtml

But when I try to call that function i got the error “update_values is
not defined”.
I have evalscript:true
If i put for example alert(‘hello’) after the function, i get the
alert when the script is loaded, but the function (Conclusion: the
script is executed but the function is not defined)

I don’t understand. For example, the function es executed if I change
the script to

But It does not work if I change it to