Very common scenario using Ajax is to parse the response and create the user interface for end user. I am still new bee to the Ajax and UI words and i only see two choices to create the UI using Ajax (JSON/XML)response ,
- CreateElement() way and go on adding/removing elements dynamically
- Create big string and set innerHTML of some element
Now i have following queestion:
- Please let me know in case there is something else better choice to do so ?
In case i would like to attach event to dynamically created elements what is the better way to do that ? I mean in many cases i end up doing something like
<input onclick="somefunction()" />
Which i really feel bad doing and does cause issue and headaches.
Thanks