Building an AJAX driven website using Codeigniter
So my question is around a complete AJAX driven website with a powerful / normal Codeigniter backend.
What I want to do is when a user comes to:
http://domain.com/#/controller/function
The main view is rendered based on the value after the #. I want to route my request based on the value after the # symbol and pretend in Codeigniter that everything is normal, do the processing开发者_如何学C that it would do and then send the output as a "response" to the AJAX request.
How would one go about making this happen? Any suggestions? Ideas on how to architect the application?
I like Sammy for this: "Sammy is a tiny javascript framework built on top of jQuery. It’s RESTful Evented JavaScript."
Example from the website:
$.sammy(function() {
this.get('#/', function() {
$('#main').text('Welcome!');
});
});
check out pathjs. It defines roots based on the # http://mtrpcic.github.io/pathjs/hashtag_basic.html#/about
精彩评论