I have this form which run service on my BE and result is displayed on new tab. It works fine but BE Service is running more than 10 minutes so currently I am refactoring it to use polling instead of 1 long time running request. Backend is done and it is now returning 202 code with ID of background job. I need to find a way how to handle 202 response in new tab and run new request to poll BE for a result. Any ideas how to "send polling code" to new tab or how to handle it in original tab?
Form is triggered with button. Now it only display 202 response on new tab. Need to find a way how to catch that response and run new request...
....
var form$ = $("<form>", {id:"myID", method :"post", action :serviceUrl, target :"_blank"});
$("body").append(form$);
form$.submit();
form$.remove();
...