I am developing for an API that required the code to be passed to it as a string, for it to run, like this:
var api = [API ID],
code = "alert('some text')";
api.evalScript(code);
But I have a lot of code to pass at the same time, how can I pass an entire function like that?
var api = [API ID];
function my_code(){
alert('one');
alert('two');
alert('three');
}
api.evalScript(my_code());
This doesn't work
evalScriptat all. Did you just pick a bad example? Could you provide a better one?