I have done this a million times (and even in the same project), but somehow the following code does not work:
inside content-script:
function DrawTrophies()
{
    $(document).ready(function()
    {
        if (window.location.pathname.indexOf("/about") > 0)
        {
                if ($('#trophyDisplay').length > 0) {
                    return;
                }
                var userId=GetCurrentUserId();
                chrome.runtime.sendMessage(
                {
                    Action: "getTrophiesForUser",
                    UserId: userId
                }, function(response)
                {
                    console.log("YAY!");
                });
           // }
       }});}
inside Background-script:
// Trophies
chrome.extension.onMessage.addListener(function(request, sender, sendResponse) {
if (request.Action==="getTrophiesForUser") {
        var file="http://www.example.com/php/loadtrophies.php?version=1.0&userId="+request.UserId;
        $.getJSON(file, function(trophies) {
            sendResponse({Result: JSON.stringify(trophies)});
        }); 
    }
});
The code is run and I even can watch the Value of JSON.stringify(trophies) from the background script, but the console.log("YAY!") never is called
No error messages in the console at all. What makes this a bit different from the other 20 places in code where this just works:
- I get external JSON-Content from Background Script.
- The page where the script is running is on https. Because the content I need is from a http - site this was the main reason to put the code in the background page at all, cause the content-script would not allow this
May any of these be the source of the problem?
