-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Making this work strictly for AJAX / JSON objects #31
Comments
I'm actually working on this right now! I should have a version of it working within a month. |
@lukeshumard awesome! For the time being, I just modified the I was wondering though, what are you guys using the |
The
You can read a tiny bit about the |
Thanks for making the gist! I'm curious, though, why wouldn't you make your |
Thanks for explaining callback! The reason I returned HTML is because I wanted to let the server generate the HTML fragments instead having to get JSON back and then use jQuery to template the fragments. I think it's just a matter of preference, but the more view code I can keep on the backend, the more maintainable my javascript will be in the future. I'm using Rails, so telling the server to do all the work was as easy as saying There will be some users who will only get a JSON response (let's say they are using someone else's API and wrapping it into HTML) so they need JSON, but there will also be others who might want the server to generate the HTML and need something similar to what I have. |
That makes sense why you would want all the code to be generated in the backend instead of JavaScript (where it doesn't really belong). It's definitely a better practice than having rendering in your script. I'm pretty sure you can still keep this separate if you use jQuery Template, although I'm working with another developer on sorting that. I'm not familiar with Rails, so I'm assuming |
Yeah if you use a templating engine, that's just as good since all of your views are in one place. That's really the key idea I guess. In Rails, using Most backend frameworks have a way to generate AJAX through a specified route. In my case, I modified the standard route These are just some items that I ran into while going through this process, so maybe they'll be helpful to you! |
This is in for version 2.0b.110415. You can now specify the options of
|
Thanks again Luke! |
Right now the plugin loads an entirely new page and strips everything except what it needs for the new content. This adds additional hits to the database (for unrelated content elsewhere on the page) when really all we are trying to load is specific objects as JSON or partials from the webserver.
It would be nice to have an option to supply an AJAX route and get the data directly from there instead of the current methodology. This could even be it's own plugin since this one seems to be more for those who can't control what is sent from the backend.
Any thoughts or plans to do something like this in the future? I guarantee a lot of people would use this feature. Thanks!!
The text was updated successfully, but these errors were encountered: