Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How do Ajax work in FuelPHP Please provide some example
  • i want to work on ajex in fuelphp but i have not find any document regarding ajax.
    i am work with mustache and now some littel information about it. plz provide with an documention and example. i have seen the Vidio but didnt understand any think.
    Please provide with the help
  • Ajax is a javascript, client side technology. As such, the framework doesn't "do" ajax.

    If you mean you want to use ajax to call a controller action, your controller should extend Controller_Rest. Check the documentation on how to use it. If has way to many options to describe here, it all depends on what you want your API to do.
  • I am my api to save and retrieve data by using ajax . i want to use ajax to call controller and pass data to controller so that controller can pass data to model and insert data in to table. And latter call value from database using module and show to user by ajax. 
    The process will be same as it normal follow only i want to involve ajax so that the data transmission can be faster...
      
  • Then you'll need to use the Controller_Rest base controller.

    See http://docs.fuelphp.com/general/controllers/rest.html
  • when i am extending Controller_Rest the i am able to see my view. i some think like that if u are using Controller_Rest  the u can not use the feature of normal Controller.
    how to use to get value 
  • You have interactive controllers (either plain, or Controller_Template based) or you have API controllers.

    Best practices say you shouldn't mix the two as you need to treat them differently. For example, API's should be stateless (so you have a different authentication mechanism), and have versioning (so you can release new versions of the API without breaking applications that still use the old one).

    If you insist, you can use Conttroller_Hybrid, with allows both template and rest usage in a single controller. But it is not advised that you do.
  • i have tryed it i got one new error that is java script error, Fatal error</b>:  Call to a member function body()
    i am trying to send json array to the java script can u provide me with some example how to use it.. 
  • HarroHarro
    Accepted Answer
    I don't do frontend so I can't help you with the javascript side of things.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion