Random quote machine http to https
$(document).ready(function() { | |
$.getJSON("https://crossorigin.me/http://quotes.stormconsultancy.co.uk/random.json",function(data) { | |
$("#quote").text(data.quote); | |
$("#author").html(data.author); | |
$("#tweet_this").attr('href', 'http://www.twitter.com/intent/tweet?text=' + data.quote + ' -- ' + data.author); | |
}); | |
}); | |
$("#get_quote").click(function(){ | |
$.getJSON("https://crossorigin.me/http://quotes.stormconsultancy.co.uk/random.json",function(data) { | |
$("#quote").text(data.quote); | |
$("#author").html(data.author); | |
$("#tweet_this").attr('href', 'http://www.twitter.com/intent/tweet?text=' + data.quote + ' -- ' + data.author); | |
}); | |
}); |
This comment has been minimized.
This comment has been minimized.
@TylerMoeller I tried a similar solution for code duplication, however doing it this way it doesn't loads the quote automatically when someone opens/refreshes the page. Also, My system has the following error:
I will update here if anything works. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
To avoid code duplication and using the proxy when it isn't needed, you can do:
Edit: Also, you'll want to encode your Twitter text, or tweets will get cut off at punctuation.