ajax - Bookmarking extension for chrome not working -
i want create chrome extension that, when clicked, gets current tab's url , passes mysql table. here's got far:
manifest.json
{ "name": "markr", "version": "1.0.10", "manifest_version": 2, "description": "the ultimate bookmarking tool", "icons": { "32": "icon.png" }, "default_icon": "icon.png", "default_popup": "bookmark.html" }, "permissions": [ "tabs", "http://*/*"], "offline_enabled": false } bookmark.html
<!doctype html> <html> <head> <link rel="stylesheet" type="text/css" href="style.css"> <script src="script_v3.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script> </head> <body> <h1>this site has been bookmarked.</h1> </body> </html> script_v3.js
$(document).ready(function(){ var taburl; chrome.tabs.query({ active: true, lastfocusedwindow: true }, function(array_of_tabs){ var tab = array_of_tabs[0]; taburl = tab.url; }); $.ajax({ url: "http://localhost/markit/site/base.php", type: "post", //default data: { var taburl: url; } crossdomain:true, cache:false, async:false, }); }); base.php
<?php $url = $_request["url"]; mysql_connect("localhost", "root", "") or die(mysql_error()); echo "connected mysql<br />"; mysql_select_db("bookmarks") or die(mysql_error()); echo "connected database"; mysql_query($write = "insert links (url) values ($url)"); ?> why doesn't work?
Comments
Post a Comment