Hello everyone,
I hate to be a bother, but I'm having some difficulty figuring this out.
Through an AJAX implementation, I am receiving a SQL Query result that has:
- An object's attribute delimited by a comma
- An entire object (database row) delimited by a colon
This is an example response to make it more clear for you. :)
1,Jeremy,130,80;2,Lauren,370,300;3,Jeancarlos,200,200;4,Luke,330,70;5,Bloom,392,108;
What I am trying to achieve is placing all of this data into an array.
I've set up a little test bed to try and get this to work; this is all I have so far:
var testString = "1,Jeremy,130,80;2,Lauren,370,300;3,Jeancarlos,200,200;4,Luke,330,70;5,Bloom,392,108";
var testArray = new Array();
testArray = testString.split(";");
for(i = 0; i < testArray.length; i++)
{
document.write("<br /> Element " + i + " = " + testArray[i]);
}
var testArray2 = new Array();
My goal is to store each ROW into an element of the array, and then RE-PARSE each element for each attribute:
This is what I have so far:
Element 0 = 1,Jeremy,130,80
Element 1 = 2,Lauren,370,300
Element 2 = 3,Jeancarlos,200,200
Element 3 = 4,Luke,330,70
Element 4 = 5,Bloom,392,108
Please help me get a multi-dimensional array that has information for each person. Example:
FinalArray[0][0] = 1
FinalArray[0][1] = Jeremy
FinalArray[0][2] = 130
FinalArray[0][3] = 80
FinalArray[1][0] = 2
You will really help with my development. Thanks so much!