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?
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?
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>
public_html/mysite.com/wp-content/plugins/insert-php
OR
How do I use this type of code in a Universal Snippet?
Last edited: