F
F
F(x)2018-11-30 09:18:47
PHP
F(x), 2018-11-30 09:18:47

How can this error be corrected?

Good afternoon! How can I fix this error: Request failed: parsererror

var request = $.ajax({
      url: "ajax.php",
      type: "POST",
      data: { myData },
      dataType: "json",
      // headers: { 
     //        'Content-Type': 'application/json',
     //        Accept: 'application/json'
    //   	},
      cache: false,
      });

php code:
$data = $sth->fetchAll();
  //var_dump($data);
  //die();
  echo json_encode($data);

could not understand how it returns html format?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
LFFATE, 2018-11-30
@LFFATE

after returning json, it's better to exit
in devtools on the newtwork tab, you can find this request and see how the answer looks like

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question