Skip to content

Instantly share code, notes, and snippets.

@msroot
Created April 10, 2012 17:50
Show Gist options
  • Save msroot/2353221 to your computer and use it in GitHub Desktop.
Save msroot/2353221 to your computer and use it in GitHub Desktop.
// ======================
// LOAD JQUERY
if (typeof jQuery == 'undefined') {
(function(){
var a = document.createElement('script');
a.type = 'text/javascript';
a.async = true;
a.src = 'http://jquery.com/src/jquery-latest.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(a, s);
})();
}
// ======================
// ===================================
// :CONSOLE
//
// (function(){
// var a = document.createElement('script');
// a.type = 'text/javascript';
// a.async = true;
// a.src = 'http://localhost:3030/javascripts/bookmarket.js';
// var s = document.getElementsByTagName('script')[0];
// s.parentNode.insertBefore(a, s);
// })();
//
// ===================================
function make_request(){
$.ajax({
url: "http://localhost:3030/johnny-k-sunny/add_video",
dataType: "jsonp",
async:false,
type: "GET",
data: "url=" + escape(window.location) ,
// data: {url: escape(window.location)},
// processData: false,
contentType: "application/json",
success: function(data) {
console.log(data.status);
alert(data.status);
}});};
var checkForJQuery = setInterval(function() {
if (typeof jQuery != 'undefined') {
console.log('Loaded');
make_request();
clearTimeout(checkForJQuery);
} else {
console.log('Waiting..');
}
}, 1000);
// $(document).ready(function() {
// make_request();
// });
//
//
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment