www.webdeveloper.com
Results 1 to 3 of 3

Thread: Display XML content in HTML page

  1. #1
    Join Date
    Oct 2012
    Posts
    4

    Display XML content in HTML page

    Hi,

    I am newbie , I have application in which check-box tree is present. I want to pre-populate the check-box's if user before checked some of those check box.

    For that am getting XML format from my back-end perl script as shown below.like , in below XML only 0, 43,44,45,46 and 50 are coming so only those respective checkbox need to checked on page load.I want to display those checked check-box on page load .How can I do this .......?

    I tried with so many examples . but am not getting solution for my problem .Below is my XML format data which is am getting from perl script .

    <perldata>
    <hashref memory_address="0x86f4880">
    <item key="0">1</item>
    </hashref>
    </perldata>
    <perldata>
    <hashref memory_address="0x86f4880">
    <item key="43">1</item>
    </hashref>
    </perldata>
    <perldata>
    <hashref memory_address="0x86f4880">
    <item key="44">1</item>
    </hashref>
    </perldata>
    <perldata>
    <hashref memory_address="0x86f4880">
    <item key="45">1</item>
    </hashref>
    </perldata>
    <perldata>
    <hashref memory_address="0x86f4880">
    <item key="46">1</item>
    </hashref>
    </perldata>
    <perldata>
    <hashref memory_address="0x86f4880">
    <item key="50">1</item>
    </hashref>
    </perldata>



    Please Help


    Thank You
    Pervez

  2. #2
    Join Date
    Jul 2008
    Location
    urbana, il
    Posts
    2,787
    Code:
    <html>
    <form>
    <input name='chk_0' type='checkbox' /><br />
    <input name='chk_1' type='checkbox' /><br />
    <input name='chk_2' type='checkbox' /><br />
    <input name='chk_3' type='checkbox' /><br />
    <input name='chk_4' type='checkbox' /><br />
    <input name='chk_5' type='checkbox' /><br />
    <input name='chk_6' type='checkbox' /><br />
    <input name='chk_7' type='checkbox' /><br />
    <input name='chk_8' type='checkbox' /><br />
    <input name='chk_9' type='checkbox' /><br />
    <input name='chk_10' type='checkbox' /><br />
    <input name='chk_11' type='checkbox' /><br />
    <input name='chk_12' type='checkbox' /><br />
    <input name='chk_13' type='checkbox' /><br />
    <input name='chk_14' type='checkbox' /><br />
    <input name='chk_15' type='checkbox' /><br />
    <input name='chk_16' type='checkbox' /><br />
    <input name='chk_17' type='checkbox' /><br />
    <input name='chk_18' type='checkbox' /><br />
    <input name='chk_19' type='checkbox' /><br />
    <input name='chk_20' type='checkbox' /><br />
    <input name='chk_21' type='checkbox' /><br />
    <input name='chk_22' type='checkbox' /><br />
    <input name='chk_23' type='checkbox' /><br />
    <input name='chk_24' type='checkbox' /><br />
    <input name='chk_25' type='checkbox' /><br />
    <input name='chk_26' type='checkbox' /><br />
    <input name='chk_27' type='checkbox' /><br />
    <input name='chk_28' type='checkbox' /><br />
    <input name='chk_29' type='checkbox' /><br />
    <input name='chk_30' type='checkbox' /><br />
    <input name='chk_31' type='checkbox' /><br />
    <input name='chk_32' type='checkbox' /><br />
    <input name='chk_33' type='checkbox' /><br />
    <input name='chk_34' type='checkbox' /><br />
    <input name='chk_35' type='checkbox' /><br />
    <input name='chk_36' type='checkbox' /><br />
    <input name='chk_37' type='checkbox' /><br />
    <input name='chk_38' type='checkbox' /><br />
    <input name='chk_39' type='checkbox' /><br />
    <input name='chk_40' type='checkbox' /><br />
    <input name='chk_41' type='checkbox' /><br />
    <input name='chk_42' type='checkbox' /><br />
    <input name='chk_43' type='checkbox' /><br />
    <input name='chk_44' type='checkbox' /><br />
    <input name='chk_45' type='checkbox' /><br />
    <input name='chk_46' type='checkbox' /><br />
    <input name='chk_47' type='checkbox' /><br />
    <input name='chk_48' type='checkbox' /><br />
    <input name='chk_49' type='checkbox' /><br />
    <input name='chk_50' type='checkbox' /><br />
    <input name='chk_51' type='checkbox' /><br />
    <input name='chk_52' type='checkbox' /><br />
    <input name='chk_53' type='checkbox' /><br />
    <input name='chk_54' type='checkbox' /><br />
    <input name='chk_55' type='checkbox' /><br />
    <input name='chk_56' type='checkbox' /><br />
    <input name='chk_57' type='checkbox' /><br />
    <input name='chk_58' type='checkbox' /><br />
    <input name='chk_59' type='checkbox' /><br />
    <input name='chk_60' type='checkbox' /><br />
    <input name='chk_61' type='checkbox' /><br />
    <input name='chk_62' type='checkbox' /><br />
    <input name='chk_63' type='checkbox' /><br />
    <input name='chk_64' type='checkbox' /><br />
    <input name='chk_65' type='checkbox' /><br />
    <input name='chk_66' type='checkbox' /><br />
    <input name='chk_67' type='checkbox' /><br />
    <input name='chk_68' type='checkbox' /><br />
    <input name='chk_69' type='checkbox' /><br />
    <input name='chk_70' type='checkbox' /><br />
    <input name='chk_71' type='checkbox' /><br />
    <input name='chk_72' type='checkbox' /><br />
    <input name='chk_73' type='checkbox' /><br />
    <input name='chk_74' type='checkbox' /><br />
    <input name='chk_75' type='checkbox' />
    </form>
    <script>
    
    var div=document.createElement("div");
    div.innerHTML= "<perldata> \n<hashref memory_address=\"0x86f4880\"> \n<item key=\"0\">1</item> \n</hashref> \n</perldata> \n<perldata> \n<hashref memory_address=\"0x86f4880\"> \n<item key=\"43\">1</item> \n</hashref> \n</perldata> \n<perldata> \n<hashref memory_address=\"0x86f4880\"> \n<item key=\"44\">1</item> \n</hashref> \n</perldata> \n<perldata> \n<hashref memory_address=\"0x86f4880\"> \n<item key=\"45\">1</item> \n</hashref> \n</perldata> \n<perldata> \n<hashref memory_address=\"0x86f4880\"> \n<item key=\"46\">1</item> \n</hashref> \n</perldata> \n<perldata> \n<hashref memory_address=\"0x86f4880\"> \n<item key=\"50\">1</item> \n</hashref> \n</perldata> \n";
    
    
     [].slice.call(div.querySelectorAll("[key]"))
     .map(function(elm){  return elm.getAttribute("key");  })
     .forEach(function(num){  document.forms[0].elements["chk_"+num].checked=true; });
    </script>
    </html>
    Create, Share, and Debug HTML pages and snippets with a cool new web app I helped create: pagedemos.com

  3. #3
    Join Date
    Oct 2012
    Posts
    4

    Display XML content in HTML page

    HI thank you so much for your response . Exactly what am looking for

    But How can I trigger perl script from server side so that I can get that XML then pass it to HTML.Please Help for this, I spent lot of time for triggering this perl script from JS, but i didn't get any result.

    Thank You
    Pervez

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.30528 seconds
  • Memory Usage 2,872KB
  • Queries Executed 15 (?)
More Information
Template Usage (33):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (3)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (73):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates