Bogdan2017-08-03 18:01:37
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">
  <meta charset="utf-8" />
  <title>Action Controller: Exception caught</title>
    body {
      background-color: #FAFAFA;
      color: #333;
      margin: 0px;

      in Institution::ReportsController#ajax_report_base

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