EllisLab text mark
Advanced Search
     
Controller echo response to Ajax request. Wrong?
Posted: 26 October 2012 09:37 AM
Joined: 2012-09-04
8 posts

Hi,

Is it wrong to have a controller method which has been invoked by an Ajax request respond with a straight echo? Then the success function in the Ajax request shoves this into a user message div somewhere.

A tiny bit of background - am trying to mould Ion Auth’s password change facilities into an Ajax context. Although the question is obviously general in nature.

Thanks in advance for any input.
Geoff

 
Posted: 26 October 2012 11:20 AM   [ # 1 ]   [ Rating: 0 ]
Joined: 2011-02-23
882 posts
$this->output->set_output(); 

is safer than an echo and the proper way of doing it!

 Signature 

ignited Community Framework (WiP)  |  Read the User’s Guide. It won’t bite.

STOP! Before posting your questions, remember the WWW Golden rule:
What did you try? What did you get? What did you expect to get?

CI example .htaccess

 
Posted: 26 October 2012 11:22 AM   [ # 2 ]   [ Rating: 0 ]
Joined: 2012-09-04
8 posts

Ahh much more elegant. I should have worked that out for myself.

Thanks!