Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How to use ajax to retrieve info from my DB?
  • Hello guys, my problem is that i need to retrieve some info related to a specific option that i select, i can do all about the DB i just need to know how to use the ajax with fuel, if you can please provide me an example
  • HarroHarro
    Accepted Answer
    Use a controller that extends Controller_Rest.

    Determine the format you want to use to exchange data (xml, json, ...?), and Either use a client-side determined format (through the HTTP ACCEPT header) or a fixed format set in the controller.

    Once done it works the same as a normal controller, only difference it that you don't return a view, but an array with data to return to the client.

    This is the basis, you need to design your API property, you need to think about authentication and authorisation, etc.

Howdy, Stranger!

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

In this Discussion