Benjamin Lawson Benjamin Lawson - 1 year ago 63
Javascript Question

How can I parse specific parts of my AJAX array in Javascript?

I used AJAX to send back an array with many variables worth of data to my page to have displayed. The array looks something like this right now:


Now I am displaying the parts of the array in my data boxes using

//AJAX Data
success: function(data) {
var array = data.split(",");
i = 0;
while (i < 25) {

This displays data that looks like this on my webpage


As you can see, the variable name in quotes and the variable value that was passed through ajax. But I only want


displayed (no quotes, no variable) . How do I get the variable name and quotes out of my displayed data?

Thank you so much!

Answer Source

use this

$.ajax({url: "demo_test.txt", success: function(result){
       // $("#div1").html(result);

        var parsed = JSON.parse(result);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download