+ Reply to Thread
Results 1 to 10 of 10

Thread: AJAX bookmarking/forward/back

  1. #1
    igames is offline x10Hosting Member igames is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    34

    Exclamation AJAX bookmarking/forward/back

    Hey people of x10!

    I am currently building a AJAX based site and i have found many tutorials and links to make the forward/back buttons work along with bookmarking, but i havent been able to get any of them to work.

    If anyone here could help me out with this i would be very happy and grateful. If you would like to see what i have right now you can check it out at http://www.playminigames.co.cc/test/index.php

    Thanks!
    Check Out My Site http://www.playminigames.co.cc
    not very far comments?PM Me

    New Promising PTC site!


  2. #2
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: AJAX bookmarking/forward/back

    This isn't what you're looking for, but are you sure that site should be using AJAX the way it does? Your site isn't application-y, it's web page-y, which suggests AJAX is not the best thing for your site. Read over:You might also want to take a peak at other, similar pages on when to use AJAX.

    Edit:
    Two problems with the page: the fragment identifiers (eg "#Games") are capitalized, so the AJAX requests are for non-existant pages (URIs are case sensitive; "/Games.php" is different from "/games.php"). The second problem is that the response text is a complete HTML document. You need a document fragment, not a document, to insert into the page.
    Last edited by misson; 06-27-2009 at 01:29 AM.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  3. #3
    nirajkum is offline x10 Sophmore nirajkum is an unknown quantity at this point
    Join Date
    Mar 2008
    Posts
    161

    Re: AJAX bookmarking/forward/back

    are you trying to make some some bookmarking social networking site . If yes there are already lots of free CMS available which do the same thing . Just download and configure it

  4. #4
    igames is offline x10Hosting Member igames is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    34

    Re: AJAX bookmarking/forward/back

    no im just trying to get the forward, back, and bookmark working, because i found out that everything loads 5 seconds faster when you dont have to load the ad every time, so do you have any suggestions on scripts that i can use?
    Check Out My Site http://www.playminigames.co.cc
    not very far comments?PM Me

    New Promising PTC site!


  5. #5
    xav0989's Avatar
    xav0989 is offline Community Public Relation xav0989 is just really nice
    Join Date
    Jul 2008
    Location
    ifk
    Posts
    4,438

    Re: AJAX bookmarking/forward/back

    For the bookmarking functionnality, it's not even AJAX, it's simple Javascript. Here, the first link I found searching on google.

    Next for your previous/next buttons, could you explain in detail what do you mean. As well, could you specify what were you able to do with those up to now?

    Finally, I would recommend that each time you click on a link, you would change or create a fragment identifier in the url, so that users can sort-of know where they are on your site (the #section part in the URL).
    Last edited by xav0989; 06-29-2009 at 09:04 AM.
    Xavier L | Community Public Relations Manager (Free Hosting Support)
    █ Yes, my position is too cool to even exist!
    How am I helping? Rate this post by clicking the icon below! (this is even better than "liking" a post)
    Terms of Service | Acceptable Use Policy | x10Hosting Wiki

  6. #6
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: AJAX bookmarking/forward/back

    Another problem is that the script that loads content based on the fragment identifier:
    Code:
    if ((window.location.href.split("#", 2)[1] == null) 
     || (window.location.href.split("#", 2)[1] == "") 
     || (window.location.href.split("#", 2)[1] == "index"))
    {
        sendRequest("../index2.php");
    } else {
        sendRequest(window.location.href.split("#", 2)[1] + ".php");
    }
    loads a relative URL, which means (eg) http://www.playminigames.co.cc/test/index.php#games tries to load http://www.playminigames.co.cc/test/games.php, which doesn't exist.

    Performance note: the 4 identical calls to split is wasteful. You could use a variable, a switch or drop the call entirely because the Location object has a 'hash' property that holds the fragment identifier, including the '#':
    Code:
    switch (window.location.hash.toLowerCase()) {
    case '':    // FALLTHRU
    case '#':  // FALLTHRU
    case '#index':
        sendRequest("../index2.php");
        break;
    
    default:
        sendRequest('../' +  window.location.hash.substring(1) + ".php");
        break;
    }
    I'm a little concerned that your script is replacing its parent, which isn't fully defined. The technique works on Safari 4, but may not work on other browsers, as elements may not be added to the document until fully processed (i.e. the end tag is encountered).
    Last edited by misson; 06-29-2009 at 01:34 PM.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  7. #7
    igames is offline x10Hosting Member igames is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    34

    Re: AJAX bookmarking/forward/back

    xav0989 i mean so you can use the forward/back/bookmark in the web browser, not a button to do it, sorry for being unclear, and mission i am still working on your suggestion, ok so i transfered the test file to my main directory and you can look at it here, you can look at the source code at http://www.playminigames.co.cc/testindex.txt and i have my js file at http://www.playminigames.co.cc/ajax.js

    could you please help me with this i am fairly new and when i click on "games" my normal url for it is /games.php so could you tell me whats wrong?
    Last edited by igames; 06-28-2009 at 11:55 PM.
    Check Out My Site http://www.playminigames.co.cc
    not very far comments?PM Me

    New Promising PTC site!


  8. #8
    xav0989's Avatar
    xav0989 is offline Community Public Relation xav0989 is just really nice
    Join Date
    Jul 2008
    Location
    ifk
    Posts
    4,438

    Re: AJAX bookmarking/forward/back

    By the way, looking at your source code, you should move the session_start() function to be the second function called, just after any header() function calls, if you have any.

    Next, concerning the previous/next functionality, I would have recommended for the time being to create previous/next buttons in your app and specifying that your users use your previous/next buttons instead, but I found a great post on AOL that covers exactly what you are searching for.
    Xavier L | Community Public Relations Manager (Free Hosting Support)
    █ Yes, my position is too cool to even exist!
    How am I helping? Rate this post by clicking the icon below! (this is even better than "liking" a post)
    Terms of Service | Acceptable Use Policy | x10Hosting Wiki

  9. #9
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: AJAX bookmarking/forward/back

    Quote Originally Posted by igames View Post
    could you please help me with this i am fairly new and when i click on "games" my normal url for it is /games.php so could you tell me whats wrong?
    The Really Simply History library that xav0989 linked to is a better solution (modulo the lack of Safari support), but if you want to know a fix for your code, take a closer look at my last post. Both my previous posts, actually, for the first describes another serious bug that still needs to be fixed.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  10. #10
    xav0989's Avatar
    xav0989 is offline Community Public Relation xav0989 is just really nice
    Join Date
    Jul 2008
    Location
    ifk
    Posts
    4,438

    Re: AJAX bookmarking/forward/back

    Quote Originally Posted by misson View Post
    The Really Simply History library that xav0989 linked to is a better solution (modulo the lack of Safari support), but if you want to know a fix for your code, take a closer look at my last post. Both my previous posts, actually, for the first describes another serious bug that still needs to be fixed.
    Correcting the bug in the oldest post will require redesigning the main page. Instead of loading a whole page in a iframe, you should load a page fragment (the content of the page) in a div.
    Xavier L | Community Public Relations Manager (Free Hosting Support)
    █ Yes, my position is too cool to even exist!
    How am I helping? Rate this post by clicking the icon below! (this is even better than "liking" a post)
    Terms of Service | Acceptable Use Policy | x10Hosting Wiki

+ Reply to Thread

Similar Threads

  1. AJAX games...
    By Sup3rkirby in forum Off Topic
    Replies: 1
    Last Post: 09-11-2008, 06:29 PM
  2. PHP and Ajax (Authentication how to ??)
    By oracle in forum Programming Help
    Replies: 3
    Last Post: 06-16-2008, 09:06 AM
  3. AJAX response xml not working
    By jspcodes in forum Programming Help
    Replies: 3
    Last Post: 06-05-2008, 08:12 AM
  4. AJAX Gaming Server?
    By Sup3rkirby in forum Programming Help
    Replies: 14
    Last Post: 12-26-2007, 04:14 PM
  5. Using AJAX to Spy On You
    By subvertman in forum Scripts & 3rd Party Apps
    Replies: 1
    Last Post: 08-15-2005, 08:41 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers