1 Answer
1

The way the code is written, if you want Orbeon Forms client-side code to recognize the answer from the server as an error, the server also needs to have in the body of the HTTP response a document that looks like:

<error>
<title>...</title>
<body>...</body>
</error>

If such a document isn't present, then the client-side code will retry the request after a delay, and show that "Loading…" in the meantime. So in your case, you would need to find a way to get the login page to answer with that document if the request was redirected from an Ajax request.

Now, I also think that Orbeon Forms should be improved in this respect, and should consider a 302 answer to an Ajax request as an error, either by default, or allowing you to configure this behavior. For this reason, I opened issue #560.