Question

is there any reason to use the post-redirect-get (prg) for a request that you know will only happen via an ajax request?

in this scenario, you might have a request that is sent (either via ajax or direct), and we're assuming on the back-end we can distinguish which is which. In the case where the direct request is handled using prg, is there any reason to also handle the ajax request with a prg too?

or can an ajax post just be responded to directly?

Was it helpful?

Solution

For something that only uses AJAX, I can't see a reason to use prg. Since it is not a user controlled action with the possibility of duplication, the only way the AJAX call would be duplicated is if the original page was refreshed before the action finished, and since prg has that same one flaw, you may as well use the direct approach.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top