Welcome Guest, Not a member yet? Register   Sign In
Best practice for AJAX quieries
#5

i use a separated controller for each ajax action, so ci only loads the required parts ( if your actions are gonna be more complex ). Mostly my ajax controller 1. collect data, 2. call a view for output formatting and 3. return it to the caller ( be sure to handle all possibilities, use the \CodeIgniter\API\ResponseTrait for returning with correct codes ).

to handle CSP correctly you need decide which request use user specific data to know which can be excluded from CSP check and which need to write session ( user specific ) data . so i exclude every trivial request ( check for news, updates ) and added a csp expiration check to the other - some request with write requirements also have the effect to extend the session validity.
to prevent this, you need call session_write_close() before sending the result back
Reply


Messages In This Thread
Best practice for AJAX quieries - by Przem4S - 09-03-2018, 06:01 AM
RE: Best practice for AJAX quieries - by InsiteFX - 09-03-2018, 09:11 AM
RE: Best practice for AJAX quieries - by Leo - 09-03-2018, 02:29 PM
RE: Best practice for AJAX quieries - by Przem4S - 09-04-2018, 12:57 AM
RE: Best practice for AJAX quieries - by puschie - 09-04-2018, 02:19 AM
RE: Best practice for AJAX quieries - by InsiteFX - 09-04-2018, 04:01 AM
RE: Best practice for AJAX quieries - by Przem4S - 09-04-2018, 04:14 AM
RE: Best practice for AJAX quieries - by puschie - 09-05-2018, 02:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB