How to use?
Firstly, include a jquery libery in your head
<script type="text/javascript" src="jquery.latest.js"></script>
Download jQuery from jquery.com.
You can also use the CDN from google:
http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
Secondly, include Cjchangeurl
<script type="text/javascript" src="jquery.cjchangeurl.min.js"></script>
Lastly, call the function after document ready
You can easily call by one line script and a separted handler OR embed the callback in the plugin.
Type 1 $(document).ready(function() { $("#a").cjchangeurl({ callback: function() { /*ajax call page*/ } back_callback: function() { /*ajax recall current page (handler to history.back*/ } }); });
Type 2 $(document).ready(function() { $("#a").cjchangeurl(); $("#a").click(function() { /*ajax call page*/ }); });
Options
Name | Default | Description |
---|---|---|
targetURL | If you make use on element other than <a>, you can use this option to asign a target url to the url change | |
callback | The callback of the page load, may be an ajax or just change tab, any action you like... | |
back_callback | The callback to redisplay the current page again when user click the back button | |
allowIEcallback | true | true | false, allow the history back callback on IE, as IE not support popstate to handle the history back event, there set a interval to check the change of hash to detect where user click back button. |