Passing from javascript to Avada wordpress php

Within Avada wordpress builder I can add php elements to a page, but I want … Read more Passing from javascript to Avada wordpress php

Within Avada wordpress builder I can add php elements to a page, but I want those php elements to accept input from javascript code on other parts of the site. Right now I have a post request in javascript

var xhr = new XMLHttpRequest();
    xhr.open("POST", "https://website/postRequests", true);
    xhr.setRequestHeader('Content-Type', 'application/json');
    xhr.send(JSON.stringify({
        value: "test value"
    }));

And php code for accessing said request

document.getElementById('comparison_1').innerText = $_GET['https://website/postRequests?value'];

I’m not sure how to link the two together. How do I send the post request to the php code if said php code is lying behind Avada?

Source: JavaSript – Stack Overflow



Leave a Reply

Your email address will not be published. Required fields are marked *