This is working:
function click(e) {
chrome.tabs.executeScript(null, {
code: 'var money = 1;'
}, function() {
chrome.tabs.executeScript(null, {file: 'peace.js'});
});
}
This is not (edited the code for ease):
function click(e) {
var test = 'test';
chrome.tabs.executeScript(null, {
code: 'var money = ' + test + ';'
}, function() {
chrome.tabs.executeScript(null, {file: 'peace.js'});
});
}
How can I pass it correctly? Thanks!