Я пытаюсь вызвать функцию файла ContentScript.js по нажатию кнопки в popu.html, как показано ниже
В popup.html
$('#properties').live('click',function()
{
chrome.tabs.getSelected(null, function(tab) {
chrome.tabs.sendRequest(tab.id, {greeting: "hello"}, function(response) {
alert(response.farewell);
});
});
});
В моем contentScript.js
chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
if (request.greeting == "hello")
var pid = $('#ctlform').attr('action').split(".")[0].split("/")[2];
var qids = [];
$('fieldset').each(function()
{
var qid = $(this).prop('id').split('_')[1];
qids.push(qid);
});
var ReqDat = pid+"p_p"+qids.join('SCIA');
sendResponse({farewell: ReqDat});
else
sendResponse({}); // snub them.
});
Но это не работает для меня .. Пожалуйста, помогите мне ...