I have a php script on my server where i get vars from database and this script return a json string like this sample with images urls :
[ { 'src':'imageurl1'} , { 'src':'imageurl2'}, ... ]
In my add-on i put the following code to retrieve by request
var imgs;
Request({
url: "http://www.page.com/get.php",
onComplete: function (response) {
imgs = response.json;
}
});
and send to a 'script.js' the values
pageMod.PageMod({
include: "domain.com",
contentScriptFile: data.url("script.js"),
attachTo: ["top"],
onAttach: function(worker) {
worker.port.emit("imgs",imgs);
}
});
But it dont work. Whats wrong ?