Skip to content
Advertisement

updating data with JavaScript functions not working properly

I want to send an Ajax request when clicking a button but it seems my request is never executed. Here is my HTML code :

JavaScript

i feel there is something wrong with my javascript code but i cant figure whats wrong ! i changed a lot of it based on the comments i got earlier . what i want is when i click on the update button it changes to ” submit again “ and i want to replace “list items” ( name and email ) with input fields and put whatever written in them to be saved in the database instead . and eventually return to the first page which is the register form. i need help in this part !! i know this part is buggy . i need to know how to reach each list item individually ( what attribute should i add/use ) and here is my javascript code :

JavaScript

here is connect.php :

JavaScript

this is Users.php :

JavaScript

and this is where i handle the database commands :

JavaScript

and this is Update.php :

JavaScript

i dont want the question to have a lot of code so hope this makes it better to understand.

Advertisement

Answer

I mentioned posting something without jQuery – here is a demo which does what I understand your requirement to be. There are comments below to explain what is going on.

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement