简体   繁体   中英

passing data in comments to aspx page

I have some ExtJs scripts running on aspx page. User fills some fields. After he is done, he presses a button and I need to dynamically add comment to this page (without reloading it) containig xml with data from this fields. Something like this should show up in html markup:

<!--
<data>
  <Param1>10</Param1>
  <Param2>12</Param2>
</data>
--> 

How should I do this? Basically, how to dynamically add comments behind the page and fill in some data. Thanks.

Something like this should do it:

<button type="button" onclick="setHtml()">Insert Comment</button>

<script>
  setHtml = function() {
    var myData = "<data><Param1>10</Param1><Param2>12</Param2></data>";
    var c = document.createComment(myData);
    document.documentElement.insertBefore(c, document.head);
  }

</script>

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