Answer the question
In order to leave comments, you need to log in
How to use ajax in a plugin?
I am writing a plugin, I need to add a setting to the database via ajax, but I don’t understand how I can accept ajax that I send in a file from the plugin, do I need to use a different url? Or is there another action/hook?
function add_new_url() {
echo '<div class="wrap">
<h1>' . get_admin_page_title() . '</h1>
<form method="post" action="' . admin_url('admin-ajax.php') . '">
<input type="hidden" action="action_add_new_url" value="">';
settings_fields( $this->option_group );
do_settings_sections( $this->page_slug );
submit_button();
echo '</form></div>';
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question