showing results for - "wordpress ajax trigger code"
Mattia
25 Sep 2020
1echo '<button id="ZapisPrace">Save</button>
2<script>
3jQuery("#ZapisPrace").click(function($){
4    var data={
5        action: "addToDB",
6        info: "nomz"
7    };
8    jQuery.post(ajaxurl,data,function(response){
9    alert("Response was "+ response);
10    });
11});
12</script>';
13add_action('wp_ajax_addToDB','pridajDoDB');
14function pridajDoDB(){
15    echo '<script>console.log("AAA")</script>';
16    wp_die();
17}