Following scenario:
This response look like:
processResponse({"LoginResponse":{"@token":"x"}})
That's it. Just that line: A string/object/text.
I have also a function processResponse()
processResponse(data){
console.log(data);
};
My Question: How to get that response executed, since it is just an object. I wish to 'parse' a string to a function call.
client.methods.loginRequest(loginArgs, function(data,response){
//response body as js object
console.log(data);
// processResponse({"LoginResponse":{"@token":"x"}})
// now I wish to execute it.
data; // this doesn't work
data.exec(); // this doesn't work
? // what else
});
function processResponse(data){
console.log(data);
};
I hope there is a way?