Skip to content
Advertisement

Upload data to database with JSON [closed]

How can I upload data to database with AJAX, JSON and PHP? Here is the code.

AJAX

JavaScript

PHP

JavaScript

What have I done wrong? Can some one help me to solve this problem? Thank you very much!

EDIT

ERROR I get back a full object

Advertisement

Answer

As the response points you have syntax error, here I refactored your code in order to work.

JavaScript

JFYI: Avoid directly placing the input variables into the query, you should use Prepared Statements.

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