How to request data from different php page without a redirect that works with Ajax?

Muhprerge

New Member
So I have this one CakePHP web application that I'm trying to refactor.
There is a large portion of code that usually works like this:
E.g. "Flag":
User clicks flag button
Redirect the user to the flag action
Flag action flags post
Redirect user to post that was just flagged. I am also trying to enhance it with JavaScript like so:
User clicks flag button
Javascript makes AJAX request to that action
Call returns with a status that JS intepretsIs there some way to streamline this sort of flow so that it is easily testable and can be covered with a javascript that doesn't need redirection?
 
Back
Top