1

I'm creating some Chrome extension and I need to have a connection to a database. I followed a tutorial from

Everything works fine except when I run XMLHttpRequest my responseText is the code of my PHP.

JS from popup.js:

let xhr = new XMLHttpRequest(); 
xhr.open(   "GET",   chrome.extension.getURL("/create.php?mail=" + mail.value),   true ); 
xhr.onreadystatechange = function() {   if (xhr.readyState == 4) {
            console.log(xhr.responseText);
            response.innerHTML = xhr.responseText;   } }; 
xhr.send();

PHP from create.php:

echo "something";
Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
Danilo Ivanovic
  • 1,216
  • 1
  • 10
  • 18

0 Answers0