Skip to content
Advertisement

AJAX + jQuery variables do not pass to PHP

I am trying to do something very simple: Pass 2 text variables to a php script and insert them into a MySQL db. For some reason however I can’t get the variables to pass (so I just get empty records in my DB).

JavaScript

And the PHP:

JavaScript

Anyone willing to take a quick look at it and point out my -probably obvious- mistake? It’s been driving me nuts for over a day.

Advertisement

Answer

This has to work:

JavaScript

and the PHP (only changed get to post)

JavaScript

Also to debug, I would suggest using firebug or chrome’s build in inspect tools.

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