How do I dynamically load a snippet of HTML and insert it into my web page? I am using Dart.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Glad you asked! Using Dart for this task isn’t much different than JavaScript, except you get typing, code completion, and a slick editing experience.
First, create the snippet.html:
Next, create the application. Notice the use of XMLHttpRequest to request the snippet. Also, use
new Element.html(string)to create a block of HTML from a string.Finally, here’s the host HTML page: