0

I have a data from php fired to my js controller. I want these data to be parsed and stored individually so I can assign them to their respective DOMS.

Here is what the data looks like:

$userData = name=Ben&age=21&gender=male&alive=true;

as you can see, the data is in whole text. How am I able to parse that text into javascipt, something like this:

console.log(userData.name); // == Ben
console.log(userData.age); // == 21
console.log(userData.gender); // == male
console.log(userData.alive); // == true
Hard Spocker
  • 765
  • 11
  • 32

0 Answers0