How do I send POST requests with AJAX ?

Get help using Construct 2

Post » Sun May 17, 2015 6:47 pm

Hi.
I'm trying to send some data (strings, arrays…) to my PHP file.
When I'm using "AJAX -> request URL" with GET data it works perfectly, but I don't understand how I should use "AJAX -> post to URL" : it always returns an empty array if I do a "print_r($_POST);" in my PHP file.
How I should use this if I want to send for example an array content ?
B
12
S
7
G
7
Posts: 450
Reputation: 4,276

Post » Sun May 17, 2015 7:46 pm

data must be formatted like this: "variable="&variable

your php file:

$var = $_POST["variable"]
B
12
S
3
Posts: 211
Reputation: 1,477

Post » Sun May 17, 2015 8:10 pm

Great, thanks. :)
B
12
S
7
G
7
Posts: 450
Reputation: 4,276


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 9 guests