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 7935043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:48:09+00:00 2026-06-03T21:48:09+00:00

I am creating an application where a users draws shapes on a canvas and

  • 0

I am creating an application where a users draws shapes on a canvas and then saves and retrieves them from a database. The saving part works fine, now though, im trying to load this XML content, Thats where the troubles are starting.

Firstly a user has a list of documents they have created, when clicked it loads that document into the applicaiton to do this, i use the following code, firstly a javascript function which takes the ID of the document, then sends it to a PHP script which retrieves that documents data from a database. The PHP script than loads that documents data into a $_SESSION['data'] variable. Once done, it goes back to the javascript function which redirects the user to application page.

function loadDocument(docID){
    $.ajax({
        url: "load_a_document.php",
        type: "POST",     
        data: { 
            documentID: docID,
        }, 
        success: function(data) 
        {
            alert(data); //THIS DISPLAYS THE XML WITH NO PROBLEMS???
            window.location = "application.php";
        }      
    });
};

The PHP queries the database and retreives the name and XML content of the document, it then does this:

$_SESSION['document_Name'] = $doc_NAME;
$_SESSION['document_XML'] = $doc_DATA;

echo($_SESSION['document_XML']); //this is 'data' on the ajax success call

Now when the PHP is finished it echoes the php context, this shows up in the alert box in the success:{} of AJAX with no problems. Now it takes the user to the actual application which begins like so:

<?php 
session_start();

$document_Name = $_SESSION['document_Name'];
$document_Data = $_SESSION['document_XML'];
?>
<script>
    alert(" <?php echo $document_Name; ?> "); //WORKS FINE
    alert(" <?php echo $_SESSION['document_Name']; ?> ") //WORKS FINE

    //alert(" <?php echo $document_Data; ?> "); //STOPS THE PAGE LOADING
    //alert(" <?php echo $_SESSION['document_XML']; ?> ") //STOPS THE PAGE LOADING
</script>

Fetching the first two items, there are no problems, as soon as XML data is printer then their is a real problem. I dont understand why the loadDiagram() can alert
()
the XML but my application page cannot. Has the data been corrupted somehow?

Thanks for any feedback.

  • 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-06-03T21:48:11+00:00Added an answer on June 3, 2026 at 9:48 pm

    You probably have quotes in the string that’s causing the problem. Try

    alert(<?php echo json_encode($document_Data) ?>);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating application which stores the users financial information in a sqlite database.
I'm creating a small application from which users can send mails, appointments and to-do
I am creating application in which I would have database which users can´t edit.
I want to write a multipaint application - a program that enables users from
I'm creating a WPF application, for which all users must be authenticated to an
I've been tasked with creating an application that allows users the ability to enter
I am creating a web application where users can upload/download/view online pdfs. I want
I'm creating an application in which there's two different types of users. Should I
I'm creating an application in Qt that allows users to drag around various modules
I am creating an application which trakcs down users path on a mapview. What

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.