Reputation: 672
I am a newbie and working on a google-chrome extension, that needs to make jquery ajax requests to a server, load some html documents . My server is Apache, running on localhost using XAMPP 1.7.3. an the jquery is jquery-1.6.1.js.
When I load it using standard browser like chrome like http://localhost/Chrome/popup.html, the jquery ajax works. And it loads the html documents funtionaly. But, the problem is when I open my extension by "Load unpacked extension" in Google Chrome (Google Chrome 11) extension developer mode. The html document won't load.
Anyone can help solving my ploblem?
this is my code :
manifest.json
{
"name": "Nyu Extension",
"version": "1.0",
"description": "My First Extension",
"permissions" : ["http://localhost/", "http://*/*"],
"browser_action": {
"default_icon": "N.png",
"popup": "popup.html"
}
}
popup.html
...
function activeTab(tab)
{
document.getElementById("tab1").className = "";
document.getElementById("tab"+tab).className = "active";
if(tab == 1)
{
$.ajax({
url: "ssc/contentpage1.txt",
success: function(data) {
$('#content').html(data);
}
});
}
}
...
please tell me if anything wrong..
Upvotes: 7
Views: 7983
Reputation: 4236
You should specify an absolute (full) URL in the $.ajax call (i.e. http://localhost/Chrome/ssc/contentpage1.txt).
Upvotes: 8