views:

51

answers:

1

Because I thought of ajax posting my form to a specific function in my controller and do a sql-insert, but I want to stay on the same page. So is it necessary to load a view in the posted url (=destination)?

+3  A: 

No, it's perfectly acceptable not to load a view and simply output the result of the operation. JSON encoding is ideal for this; see PHP's json_encode. You could even create a view that outputs the JSON code if you're a purist, though there's no real need.

Will Vousden