AJAX Button Implementations: How Do They Work?

My page is still loading once, and then all AJAX is from there, baby: D. Obviously back / forward / reload / history / bookmarking seriously violates it. I am learning some solutions (I am looking at jQuery, aka BBQ or Address plugins) and I am curious how they are implemented.

All that interests me seriously is the functionality of Back / Forward, since this is a true “application” for use by perhaps 5-6 people to help coordinate their tasks and in no way forms or forms a “web document”. I am trying to prevent the usual habits of the habits of the window habits that violate my application.

So far, I have not encountered a situation where more than one state could enter another state, and therefore my return functionality was quite simple to implement. However, none of the return functions was implemented using the "Back" function, but only through the "Cancel", "Back" and other buttons.

But I digress ... For now, I really like the idea of ​​a simple system of identifiers for URL fragments that allows you to use the back / forward functions, and I would really like to avoid throwing other people's code into the problem (this is my first webapp and I try to do everything as painful as possible to learn).

Okay, I'm not distracted anymore ... I got the impression of this article in Content with Style that I could use a timer to poll my window URL and activate the appropriate AJAX actions.

I am interested to know:

  • If common plugins to fix AJAX backward / forward workarounds use a similar method, and if not, what methods do they use?
  • What are the pros. and cons. survey method, as well as any of the alternative methods.
  • Can I implement a simple version of these methods that will fulfill my goals? (say up to 150 lines).
  • Is it worth it to do it yourself? Am I going to find out something valuable if I implement it? Will my (theoretically) simpler version really have a lot less code than a comprehensive plugin?
+5
1

AJAX / , , ?

, hashchange.

. . , .

  • : -, -
  • :

, ? (, 150 ).

5 , , hashchange. 2-3 :)

window.onhashchange = function(event) {
    var url = event.newURL;
    // do something with new url
};

? - , ? () , ?

, . . . , Rails router . :

"/signup"           -> (UsersController, new)
"/user/(id)/photos" -> (PhotosController, index)

API /- JavaScript , , :)

+2
source

All Articles