How do I post variable to a php page?

Get help using Construct 2

Post » Sat Oct 21, 2017 6:41 pm

I was trying to post a simple variable to a php page from construct using AJAX post to url method. Here's my PHP code
Code: Select all
<?php
header('Access-Control-Allow-Origin: *');
if (isset($_POST["X"])) {
    $x = $_POST["X"];
    echo $x;
}else{
    echo 'no variable received';
}
?>

Here's a screenshot of my C2 code
Image

Can somebody tell me what am I doing wrong here? And also its pretty straightforward in Jquery AJAX and in Construct 2 what to do with that data field is not very clear. What does it mean "The data to post, in query string form"?

Thank you in advance for taking a look at it.
B
9
S
3
Posts: 28
Reputation: 735

Post » Sat Oct 21, 2017 7:55 pm

Locked as duplicate of https://www.scirra.com/forum/viewtopic.php?f=147&t=197038.

Please do not multi-post the same question after only 15 minutes.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
140
S
31
G
88
Posts: 5,731
Reputation: 61,448


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot], thomazette and 13 guests