[code]
$('#myform').ajaxSubmit({
error: function(xhr) {
document.open();
document.write(xhr.responseText);
document.close();
},
success: doSomething
});
[/code]
Isn't there a "nice" jQuery way of doing this anyway?
Cheers, B
On May 29, 11:13 pm, BalusC <bal...@gmail.com> wrote:
> The server side (JSP/Servlet in this case) can throw an unexpected
> exception (ServletException in this case). The exception is on the
> server side handled as an error page, which returns just a complete
> HTML page with the exception details. I'd like to let ajaxSubmit's
> error option show the entire page. With other words, it must handle it
> as synchronous response rather than asynchronous response.
>
> I can't manage to get it to work. I tried under each the following:
>
> [code]
> $('#myform').ajaxSubmit({
> error: function(xhr) { $(document).html(xhr.responseText); },
> success: doSomething});
>
> [/code]
> Unfortunately this displays a blank document, although alert
> (xhr.responseText) shows the correct and complete HTML response.
>
> But to my surprise this works:
> [code]
> $('#myform').ajaxSubmit({
> error: nonExistingFunctionName,
> success: doSomething});
>
> [/code]
> This works exactly as if it was a synchronous request. This also shows
> an error "nonExistingFunctionName is not defined" in the JS error
> console. But the big pitfall is that the success part (and the remnant
> of the JS code) won't be executed anymore due to the same error as it
> is apparently been interpreted anyway. So if no exception is been
> thrown, nothing will happen anymore.
>
> Any insights? How could I show the xhr.responseText as if it was a
> synchronous response?
No comments:
Post a Comment