Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

woo axios

    <script>
        // Here I define a path to 'myActions.php' file
        const myActionsUrl = '<?php echo get_template_directory_uri() ?>'+'/myActions.php'

        var params = new URLSearchParams();
        params.append('action', 'my_own_function');
        params.append('price', '199');

        async function runPHP(){
            axios.post(myActionsUrl, params)
            .then(function (response) {
                console.log(response)
            })
            .catch(function (error) {
                console.log(error);
            });
        }
    </script>

    <button onclick="runPHP()">Run myActions!</button>
Comment

PREVIOUS NEXT
Code Example
Javascript :: socket io across two different ports 
Javascript :: ecmascript make file for one function 
Javascript :: Nested objects and files 
Javascript :: Create Compond from route to js function communication 
Javascript :: logvalue returned from array 
Javascript :: how to catch shortcut keys in jquery 
Javascript :: Mapping an Array to Elements with v-for 
Javascript :: babel 7 ReferenceError: regeneratorRuntime 
Javascript :: php vscode editor.rulers vetical line delimiter line 
Javascript :: message is not working on emit in node.js 
Javascript :: javascript prototype chaining in stackoverf 
Javascript :: crypto digest node.js 
Javascript :: javascript etaretot 
Javascript :: hover inline css 
Javascript :: New year chaos solution 
Javascript :: mcrypt_rand rewrite in node js 
Javascript :: redux extension link 
Javascript :: limit frontend request 
Javascript :: nuxt js index.html not found 
Javascript :: call function on scroll down javascript 
Javascript :: npm password validator 
Javascript :: Make React Tooltip work for dynamic elements 
Javascript :: javascript border textbox 
Javascript :: Backbon events In View 
Javascript :: destructuring function nested parameters 
Javascript :: check if a text field is empty javascript 
Javascript :: Create a new object where the prototype is {0:10} 
Javascript :: how to iterate through linked list javascript 
Javascript :: how to style on-click in react/ vuejs router 
Javascript :: apollo client multiple endpoints 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =