#Bitlr
A simple, lightweight jQuery plugin used to shorten a link using Bit.ly.
##Instructions
Include jQuery and the plugin in the head or footer of your page.
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script src="/js/plugins/bitlr.js"></script>
Initialize the plugin and pass the function your api key, the link you want to shorten and the success callback function.
$.bitlr({ apiKey: 'XXXXXXXXXXXXXXXXXXXXX', link: 'http://google.com', success: function(newLink) { console.log(newLink); } });
####Required Properties
- apiKey: string
A string that defines your api key provided by Bit.ly. - link: string
A string that defines the link you'd like to shorten. - success: function(newLink)
A callback function that is triggered after the request is sucessful. The callback returns the new shortened link.
####Optional Properties
- anchor: bollean
A boolean value that indicates whether or not the shortened link should be returned as an anchor (default: false). - error: function()
A callback function that is triggered after the request if the request is not sucessful.
#####Example:
$(function() { $.bitlr({ apiKey: 'XXXXXXXXXXXXXXXXXXXXX', link: 'http://google.com', success: function(newLink) { console.log(newLink); }, error: function() { console.log('There was an error.'); } }); });