This could be a basic question but , i'm stuck with this for some time.
i have a data
{pid: 'WEB506', session: 'WEB506_09092021_M1_S1.csv'} how to convert this to
{ "pid":"WEB506", "session":"WEB506_09092021_M1_S2.csv" }; regards. i used JSON.stringify and i got it as
{"pid":"WEB506","session":"WEB506_09092021_M1_S1.csv"} but when i pass this to ajax data to call an api , the value entering req.body is
{ '{"pid":"WEB506","session":"WEB506_09092021_M1_S1.csv"}': '' } This is my ajax call
function graphApi(){ const apiValue = JSON.parse(localStorage.getItem('user')); console.log(apiValue,"apiValue"); const f = JSON.stringify(apiValue); console.log(f,"ffff") $.ajax({ type: "POST", data: f, url: "http://localhost:5000/File", success: function (data) { console.log(data,"graph api"); } I really don't know what is happening.
regards