How To Make Json Key Value Pair Using Two Var
I have two var's var a = result.master_id; var b = result.session_name; i want to create a json string to pass to ajax. i tried this var userData = {'pid':a,'session' :b}; i'm st
Solution 1:
You are using the right code to store into variable. Try to console variable to identify.
Example code given below:
let result = {
master_id: 1,
session_name: "Hardik"
}
var a = result.master_id;
var b = result.session_name;
var userData = {'pid':a,'session' :b};
console.log(userData);
Post a Comment for "How To Make Json Key Value Pair Using Two Var"