I have the following function in my plugin
function IsIdInProject($id=null){
if ($id=="test")
{
return true;
}
return false;
}
I need to call this function from my page using jquery, but I do not understand what to put in my url parameter.
This code is located in settings.php page of my plugin (plugins/myplugin/settings.php)
I cannot just call url: mywebsite.com/plugins/myplugins/settings.php
, right?
try to use action wp_ajax
add_action( 'wp_ajax_my_action', 'my_action_callback' );
function my_action_callback() {
$var ="no var";
$id=$_REQUEST['id'];
if ($id=="test")
{
$var=$id;
}
echo $var;
wp_die(); // this is required
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.