I am fetching results from php via ajax. My result in the serverside looks like this.
Array
(
[0] => IBM Mainframe
[1] => Intel
[2] => MIPS
[3] => MMIX
[4] => Computer Science (AP/College Intro)
[5] => Computer Science (College Advanced)
[6] => Android Programming
)
I am currently printing it out in console.
Serverside : print_r($result);
Clientside :
success: function(r){
console.log(r)
}
I want to fetch the result and within the success convert it into something like this :
var name = [
"IBM Mainframe",
"Intel",
"MIPS",
"MMIX",
"Computer Science (AP/College Intro)",
"Computer Science (College Advanced)",
"Android Programming"
]
So I can use that variable later
success : function(r){
..............
var name = ....
}
print_r()!!! Javascript is not going to be able to make any sense of that!!! Encode the array to JSON and then you have a array that javascript can actually make some sense of. I want to fetch the result and within the success convert it into something like this That will all be done in a simple one line command if you send JSON data back to the browser