I have successfully implemented code to send information from a website to a server. The code I used is as follows:
<!DOCTYPE html> <html> <script> var Network = {"name":"", "password":""} var json; var xhr = new XMLHttpRequest(); var Json = JSON.stringify(Network) function Info(sp) { let svar = prompt(sp, "Enter information here"); return svar } Network.name = Info("Enter internet name"); Network.password = Info("Enter internet password"); console.log(Network); xhr.open("GET", "/network?Json="+Json+"}", true); xhr.send(); </script> </html>
Although this code is functional, I am encountering an issue that I am unsure whether is a bug or error. When trying to deserialize the Json object on my esp8266 using the ArduinoJson library, I receive an error message stating "IncompleteInput." Upon inspecting the AJAX request here, it is evident that there is a missing end bracket in the text, which I suspect is causing the error. Manually typing in the missing character resolves the issue. How can I correct this problem?