Having this scenario where not logged users can fill a form submit it but redirected to login/register, then after login/register the form previously filled will be submitted.
Also, the user ID has to be submitted with along with the form data, hence the need to login/register.
What I am currently doing is, persist the form data to local storage, then when the user login, I get the form data saved to local storage and perform an AJAX request with. The problem with this approach is that upon successful login there is a redirection which hinders the AJAX request from firing.
@tisuchi Also tried using session encountered some issues (which I can't remember now) with it too though I didn't generate unique ID for each visitors