How do I Send Multiple Data through Single Ajax Request

0 favourites
  • 6 posts
From the Asset Store
Data+ is the best Data Management solution for Construct 3. It contains 4 Addons (Plugin & Behavior).
  • I have been trying to send multiple bits of form data through a single Ajax request without any success.

    I have tried multiple different ways but will include an image of what i think it should be like but isn't working as expected.

    Image of Events

    Debug Ajax log

    As you can see it isnt right?

    Any help would be much appreciated.

    Base

  • Your php is set up to return the data it received?

  • I have it setup to show me what it recieved.

  • Base

    hello,

    i have same problem...

    im trying to POST several variables in the same ajax request but no luck...

    Did you solve this?

  • this is mine ajax data

    "user_id="&userID &"reg="&reg &"os="&OS

    part my php that handles it looks like this:

    if(isset($_POST['user_id'])&&isset($_POST['reg'])&&isset($_POST['os'])){
    
         $user_id = strip_tags(mysqli_real_escape_string($link, $_POST['user_id']));
         $reg = strip_tags(mysqli_real_escape_string($link, $_POST['reg']));
         $os = strip_tags(mysqli_real_escape_string($link, $_POST['os']));
    
         $sql = mysqli_query($link, "INSERT INTO `$db`.`users` (`id`,`user_id`, `reg`, `os`) VALUES ('','$user_id', '$reg', '$os');");[/code:3gzpo2r0]
    
    it works ok for one dataset... eg. user_id it set to table as intended but how to send several items at once?
    ...becouse i get all set in user_id in one string
    
    So i assume problem is in ajax data setting... i must be doing it wrong?
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • SOLVED:

    it was needed to add extra "&" to the each fillowing expression

    eg.

    "user_id="&userID &"&reg="&reg &"&os="&OS

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)