• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

QUESTION Where do I put the php file when using jquery with an AJAX call in Woody Snippets?

Messages
5
Likes
0
Points
1
#1
Hello,

I am trying to use AJAX in a Universal Snippet. The AJAX call asks for a "url:", where do I put the php file?

Code:
<script>
$(document).ready(function(){
    // code to read selected table row cell data (values).
    $(".btnSelect").on('click',function(){
         var currentRow=$(this).closest("tr");
         var col1=currentRow.find("td:eq(0)").html();
         var data=col1;
         alert(data);
         $.ajax({
             url:'what directory do I put this file in?',
             method: 'post',
             data: 'data=' + data
         }).done(function(id){
             consolg.log(id);
             id = JSON.parse(id);
             $('#table_id').html('$row = ' +id.id ';')
         })
    });
});
</script>
Do I place the php file for the url: in the directory below?
public_html/mysite.com/wp-content/plugins/insert-php

OR

How do I use this type of code in a Universal Snippet?
 
Last edited: