简体   繁体   中英

How do I populate a form in JSP with data obtained from a Javascript function

I have a working Javascript function manipulateData() in a some.js file.

I have included that JS file in info.jsp in head and also made it available on body load. Within manipulateData() function, I have another function which returns that data which I want to use to populate that JSP form.

How can I invoke the function within a JS function from the JS file, in a JSP. Any help is appreciated.

Not sure if this helps but ...

An inner function will only ever exist if its outer function is executed, and each execution of the outer function will create a fresh instance of that inner function.

An inner functions will cease to exist when the outer function completes unless a persistent reference to the inner function is kept, either :

  • by assignment to a js var (or object property) in the outer function's outer scope (eg by having the outer function return the inner function), or
  • by attachment to a DOM element as an event handler.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM