Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 592231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:43:06+00:00 2026-05-13T15:43:06+00:00

XML responses from my webapp have both HTML to add to the page AND

  • 0

XML responses from my webapp have both HTML to add to the page AND some have a script to run.

I’m trying to send back XML from my webapp like:

<?xml version="1.0"?>
<doc>
  <html-to-insert>
    <![CDATA[<p>add me to the page</p>]]>
  </html-to-insert>
  <script>
    <![CDATA[ alert('execute me'); ]]>
  </script>
</doc>

What I’m doing now is snapping out the <html-to-insert> and <script> CDATA, inserting the html into the page and eval’ing <script>.

I’m looking for criticism on my approach. Any suggestions from anyone?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T15:43:06+00:00Added an answer on May 13, 2026 at 3:43 pm

    You’d rather send JSON, it’s way easier to interpret. Example:

    // Suppose your response is a string:
    // { html: "<p>add me to the page</p>, script:"alert('execute me');" }
    var obj = eval( "(" + response + ")" ) ;
    eval( obj.script ) ;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to log some XML responses from a WCF Service using log4net.
I am getting responses from two different web services in XML format. Both web
I am trying to use xml.etree.ElementTree to parse responses from eBay finding API, findItemsByProduct.
I am trying to populate a variable with an XML response from an ajax
I've got XML coming back from an Ajax.Request in Ajax.Response.responseXML . My XML actually
What's the best way to output different types of responses f.ex xml, json, html,
I'm using Nokogiri::XML to parse responses from Amazon SimpleDB. The response is something like:
We have to compare responses (XML) of two different but they are doing the
I have a gigantic QuickBooks SDK .XSD schema file which defines XML requests/responses that
I'm currently looking for an easy way to extract information from server XML responses

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.