0

I have been working with on project. It was working at first but now I get a error when I moved it to a server that we have. I have been working with html and php. Here is the error "(index):26 Uncaught TypeError: Cannot read property 'innerText' of null at saveTable ((index):26) at HTMLButtonElement.onclick ((index):21)" This is from google chrome. And here is line 26 and 21:

Line 21

<button type="button" onclick="saveTable();">Spara</button> 

Line 26

xhttp.open("GET", "backend.php?action=save&Adress=" + document.getElementById("Adress").innerText + "&Fastighet=" + document.getElementById("Fastighet").innerText + "&Kostnadsstalle=" + document.getElementById("kostnadsstalle").innerText + "&Fabrikat=" + document.getElementById("Fabrikat").innerText + "&Typ=" + document.getElementById("Typ").innerText + "&Model=" + document.getElementById("Model").innerText, true);

3 Answers3

0

Difference between innerText and innerHTML. This might help. innertext is not supported in some browsers like Mozilla. As for Google Chrome, I'm not sure but I advice you check this link.

0

Give the table headers an id before using it.

Edit: Oh. Well. Just saw it now. I don't think this is the reason at all. The function loadTableContents() is called before saveTable(). So I think your code is perfectly alright. And since you said it worked before the problem is with your server

0

Found the problem, it was a misstype that's all. I forgot to use capital letter and now it's fixed