Suppose I am in need of initiating an ajax call to my server
$.ajax({
type: 'POST',
url: 'url/url',
success: function(response){}
});
and upon receiving a response from the server, I send some JavaScript code
res.send("const myFunc = (b) => { console.log(b) }");
Is there a way to achieve something similar to this?:
$.ajax({
type: 'POST',
url: 'url/url',
success: function(response){
response('hello'); //I want 'hello' to be displayed in the console
}
});