Question

I'm beginner to Lithium framework. Could anyone please help me to understand flow of ajax request in this framework via an simple example. e.g. I'm using jquery and I have to access a method in controller via ajax call and then need to display result in view. Controller function can be called from normal request as well as for ajax request.

Thanks in advance!

Was it helpful?

Solution

Perhaps if you posted a little bit of code, we could show you some code, in return.

By default, Lithium responds to HTML and JSON requests.

Suppose you have an action named index within PostsController, you would, by default, access it via /posts/index which would return HTML.

However, if you access /posts/index.json, you should get json output which you can process via jQuery. Of course, you'd have to comment out media.php in bootstrap.php and I'm also assuming you haven't changed the default routes.

There's a bit of info here as well, if you're interested.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top