Skip to content
Advertisement

Jquery .ajax method=”post” but $_POST empty

JavaScript

I have set method type as post but in Save.php I just get values either in $_GET or $_REQUEST but not in $_POST.

My form looks like:

JavaScript

It was not working, looked around here and on Google, tried adding enctype

JavaScript

but still $_POST empty?

How do I make it work?

Advertisement

Answer

Instead of method: "post" you need to use type: "POST"

So this should work without any alterations to your form HTML:

JavaScript

Not sure why it doesn’t work but this works for me:

save.php

JavaScript

file.html

JavaScript

Your error must lie somewhere else.

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