I really googled a lot but found no answer which covers my question.
I'm developing a chrome extension and I want to make an ajax call by jquery.
I make it like this:
popup.js
$(function()
{
$('#btn').click(function()
{
$('#wait').html('loading...');
jQuery.getJSON("http://domain.com/extension_php_files/generate.php?callback=?",
{id:25},
function(data)
{
$('#wait').html('');
console.log( JSON.stringify(data) )
$.each(data, function(key, val)
{
alert(key + ' ' + val);
});
});
});
});
And here is my popup.html
<!doctype html>
<html>
<head>
<title></title>
<script src="jquery.js"></script>
<script src="popup.js"></script>
</head>
<body>
<a href="#" id="btn">SEND</a><br /><br /><br /><br />
<span id="wait"></span>
</body>
</html>
And manifest.json
{
"manifest_version": 2,
"name": "black",
"description": "black here",
"version": "1.0",
"permissions": [
"http://domain.com/*"
],
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
}
}
When I click on the SEND
button, I see Loading...
but it never goes into success function. I googled but couldn't figure out the problem.
What am I doing wrong?
PS: My server side code works just fine.