Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function handleInit(event) {
- if (event.path != "/") {
- var hash = event.path.replace(///,"").replace(/?/g,"");
- getPage(hash);
- currentState.hash = hash;
- } else {
- currentState.id = 1;
- }
- SWFAddress.addEventListener(SWFAddressEvent.CHANGE, handleChange);
- }
- function chapter_forward() {
- if (!freeze) {
- freeze = true;
- getPage(currentState.id - 1);
- }
- }
- function ajax_data(id) {
- return typeof(id) == "string" ? "hash=" : "page=";
- }
- function getPage(id) {
- $.ajax({
- method: "get",
- url: getPage.php,
- data: ajax_data(id) + id.toString(),
- dataType: 'json',
- timeout: 2000,
- error: function() {
- $("#space-3").html('40104 - Request Timeout');
- },
- complete: function() {},
- success: function(result) {
- handleContent(result);
- }
- });
- }
- {"article_id":"3","hash":"music-in-your-ear","title":"Music in your ear.","html":"Blah blah article 3","modified":"Fri, 20 Mar 2009 02:46:00 GMT"}
Add Comment
Please, Sign In to add comment