S
S
SPART4K632021-07-12 07:46:20
JavaScript
SPART4K63, 2021-07-12 07:46:20

Why am I getting an error on response.json() on Mozila?

Good afternoon.

function queryToServer(type, numDay)
  {
    return fetch('/admin_test/api.php', {
          method: "POST",
          headers: {
              'Content-Type': 'application/json',
              'Accept': 'application/x-www-form-urlencoded;charset=UTF-8'
          },
          body: JSON.stringify({type: type, day: numDay})
      })
    .then((response) => {
        console.log(response)
              return response.json();
          })
      .then((data) => {
      return data;
    	})
    	.catch((error) => {
      	console.log(error);
   	})
  }


Here is the response from networks browser
[{"order_status":"\u041e\u0436\u0438\u0434\u0430\u0435\u0442 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f","number_status":"1"},{"order_status":"\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d","number_status":"22"}]


Google chrome
60ebc8cbcd942117538145.png
Mozila
60ebc9134a53b365712300.png

Error in Mozila
SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data

Help me figure it out please

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