Welcome Guest, Not a member yet? Register   Sign In
Best practice: Allow for bookmark/permalink of jquery-generated (ajax) views?
#1

[eluser]mhulse[/eluser]
Hi,

I have a CI project that generates (via "ajax") HTML based on user input (i.e. user generates HTML via multiple forms).

Long story short, I would like to allow the user to "bookmark" their "creations".

Any tips on the best way to go about this?

Looking at a similar app (in terms of what I might do for bookmarking), here is how Color Scheme Designer 3 does bookmarks:

http://colorschemedesigner.com/#3911Tw0w0w0w0

That looks like they are utilizing the database to store pemalinks?

Any tips on how I might go about this in CI?

Thanks so much for reading.

Cheers,
Micky
#2

[eluser]WanWizard[/eluser]
You will have to handle this client side, as a URL anchor (#3911Tw0w0w0w0) doesn't have any meaning server side, and will be stripped from the URL by the webserver.

You have to create a script that captures the anchor, and converts it to an ajax call to restore the state that anchor represents.
#3

[eluser]mhulse[/eluser]
Hi WanWizard! Thanks so much for you quick reply, I really appreciate the help. Smile

[quote author="WanWizard" date="1281927119"]You will have to handle this client side, as a URL anchor (#3911Tw0w0w0w0) doesn't have any meaning server side, and will be stripped from the URL by the webserver.

You have to create a script that captures the anchor, and converts it to an ajax call to restore the state that anchor represents.[/quote]

Ah, interesting! Sounds good... I think I can work this logic into my interface.

Can you think of any other options? For example, would it be rediculous to generate an HTML flat file of the page? Hmmm, I guess that would be overkill.

Also, I wonder how Color Scheme Designer code translates that hash? Do you think it is all JS, or do you think they query the DB (with ajax) using the hash as a PK (which returns page state "data" to the JS in view)?

Thanks!!! I really appreciate your pro help! Smile

Cheers,
Micky
#4

[eluser]WanWizard[/eluser]
They probably save your color scheme in the database with a random hash as key.

If you go though http://colorschemedesigner.com/js/app.js, you'll se how it is done.
#5

[eluser]mhulse[/eluser]
[quote author="WanWizard" date="1281930736"]If you go though http://colorschemedesigner.com/js/app.js, you'll se how it is done.[/quote]

Ooh, good call! I did not think to look directly at their JS! Smile

Thanks Wan, I appreciate the help!

Cheers,
Micky




Theme © iAndrew 2016 - Forum software by © MyBB