B
B
Bogdan2017-08-03 18:01:37
JavaScript
Bogdan, 2017-08-03 18:01:37

AJAX and a new page?

Hello. Tell me please. In my case of an error, AJAX returns an error page. How to open it in a new or in the current tab. Perhaps it can immediately be accepted as a DOM object. instead of through a text variable? Thank you.
Function snippet:

const respond = await fetch( url, { method: type, body, headers, credentials, redirect: "error"} );

      if ( !respond.ok ) {
        data = await respond.text( );
      }

Page example:
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <title>Action Controller: Exception caught</title>
  <style>
    body {
      background-color: #FAFAFA;
      color: #333;
      margin: 0px;
    }
  </style>
</head>
<body>

<header>
  <h1>
    Savon::SOAPFault
      in Institution::ReportsController#ajax_report_base
  </h1>
</header>
...
</body> 
</html>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question