Hot answers tagged

2

You have not added wp_ajax_nopriv so that is the reason for ajax failure for non-logged in users. public function register() { add_action( 'wp_ajax_tidplus' , array( $this, 'post' ) ); add_action( 'wp_ajax_nopriv_tidplus' , array( $this, 'post' ) ); } Please do this change and check.


2

Keep in mind not everyone is running JavaScript, so you really need a server-side form processor like PHP rather than relying solely on jQuery. Best thing to do on a WordPress site is create a plugin that processes your form. You can include helper libraries like FPDF to not only generate the PDFs but that also have the option to save them to your server ...


1

In order to change the shortcode value by leveraging ajax, you need to modify the PHP code and jQuery as mentioned below: function table_generator() { // Set product providers $providers = array( 'Provider 1', 'Provider 2', 'Provider 3', ); // Build provider selection form $output .= '<form id="submitProvider" ...


1

I mean is_admin() is to check if you are on the administration so it will return false, so the code inside won´t be executed on the front-end, won´t it ? When you send an AJAX request using this method, you are sending it to wp-admin/admin-ajax.php, which is in the admin. This is explained in the text you've quoted yourself: Both front-end and back-...


Only top voted, non community-wiki answers of a minimum length are eligible