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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:54:18+00:00 2026-06-02T04:54:18+00:00

I have a list in javascript that is to be changed by the content

  • 0

I have a list in javascript that is to be changed by the content of a database when the user clicks a link or slides a bar. I currently use a xmlhttp request to fetch a php page which generates the list.
I have a static list working in this form:

var mark_list = [
{ "EntID" : 3, "x" : 100, "y" : 400},
];

I tried to have the php page generate the { “EntID” : 3, “x” : 100, “y” : 400} and set mark_list equal to responseText but I believe that’s just a string. I’m struggling to find a way to get this new list into the variablie.

Does anyone have any suggestions or solutions? Your help would be greatly appreciated.

Kallum

  • 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-02T04:54:20+00:00Added an answer on June 2, 2026 at 4:54 am

    Make sure the browser has a JSON object by including the json script from here: https://github.com/douglascrockford/JSON-js/blob/master/json2.js

    It will defer to the native browser JSON object if available, and if not, will add it so that this functionality is available in browsers that don’t currently support it.

    Then in your code, after you receive the output from the PHP script, run this:

    var mark_list = JSON.parse(responseText);
    

    Based on the output from the PHP script, you may need to do this:

    var stuff = JSON.parse(responseText);
    var mark_list = [stuff];
    

    This will convert the JSON string the PHP returns into an actual javascript object.

    In your PHP code you can do something like this:

    $output = array(
        array(
            'EntId' => 3,
            'x' => 100,
            'y' => 400,
        ),
    );
    
    echo json_encode($output);
    

    Then you can use the var mark_list = JSON.parse(responseText); option in your JavaScript.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list of tasks that I allow a user to sort, currently
i have list of rows that user select and i want to delete them,
I have an application that shows a list of items. The user can click
I have the following JavaScript to get a random image from a list of
I have a javascript code, whereby I'm trying to load a list from a
I have written a simple application that displays a list of candidates for a
I have the following HTML containing a drop down list (single selection) <script type="text/javascript">
I have the following javascript that is being called in the OnClientReordered event. I
Banging my head against the wall..... I have a SP list that uses an
Update: I have changed my JavaScript code, and I am now receiving errors in

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.