It looks to me like your problem is that you're returning literally "['Name']"
and you interpolate into an onLoad value that is itself wrapped in single quotes. I can't trace exactly why you'd end up with precisely what you're saying you're getting, but I'm guessing you didn't supply us your exact javascript code and that the onLoad is wrapped in the same quotation as the Name
( here you show single quotes where the string is being terminated ). So you end up writing out html that looks like this:
The onload becomes "initPage([" ( from your error I'm seeing the onLoad setting is terminated after the [
so it must have the same quotation as the onLoad string itself) and that of course, is not valid javascript.
You can of course pass strings with parameters as javascript. You can also pass arrays as parameters. But you cannot write both '
and "
into a javascript expression which is itself enquoted with either one, unless you escape it.
Hope it helps!