Skip to main content
Known Participant
November 5, 2021
Question

pass variable from js to php

  • November 5, 2021
  • 1 reply
  • 129 views

adobe animate build to files one html and one js.

how can i pass vaiiable from js to html or php?

    This topic has been closed for replies.

    1 reply

    kglad
    Community Expert
    Community Expert
    November 7, 2021

    var xmlhttp;

    var domParser = new DOMParser();

    //Parse the XML string into an XMLDocument object using
    //the DOMParser.parseFromString() method.
    //var xmlDocument = domParser.parseFromString(xmlString, "text/xml");
    if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp = new XMLHttpRequest();
    } else { // code for IE6, IE5
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }

    xmlhttp.onreadystatechange = function () {
    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
    console.log("TEST15");
    var xml_string = xmlhttp.responseText;
    }
    }


    xmlhttp.open("GET", "abc.php?receive_1="+var_1toPost+"&receive_2="+var_2toPost+"&receive_3="+var_3toPost,true);
    // in php:

    /*
    <?php
    $received_1 = $_GET['receive_1'];
    $received_2 = $_GET['receive_2'];
    $received_3 = $_GET['receive_3'];
    */
    xmlhttp.send();