Tag Info

New answers tagged

0

That error was identified by stackoverflow - it's actually caused by Rapport software, a security tool some banks recommend. You could turn it off / remove it from development machines.


0

Add die(); to the end of the function handle ajax. Add return false; after jQuery.ajax function tw_pages_results() { //stuff die(); } jQuery(document).ready(function() { jQuery.ajax({ type : "post", dataType : "html", url : "<?php echo site_url(); ?>/wp-admin/admin-ajax.php", data : {action : "tw_pages_results", 'page':0, ...


0

Ajax suggestion, JQuery suggestion 1, JQuery suggestion 2 (that's not a footie score, by the way!) Something I wondered as your design isn't responsive. Sidebar may be cut off on phones/tablets - how will that work? If you're only aiming at desktops, load time may not be crucial but you may want to combine or slim down some of the stylesheets, scripts, ...


0

It turns out that some themes disable functions.php for the backend, in order to prevent a complete lockout. The way they do this, is by simply doing an is_admin() check. However, since all AJAX is ran through admin-ajax.php, this returns true, and the theme functions are not loaded. In this particular case (Genesis Framework (theme) with Dynamik website ...


0

You need type: 'POST' in your jQuery.ajax call. The default is GET, and this requires POST. Because someone below requested an example: jQuery.ajax({ url: dgxDonateAjax.ajaxurl, data: data, type: 'POST', success: function() { console.log("-- SeamlessDonationsCheckout: jQuery.ajax success"); //response(data); } });


0

According to me, there is an issue with cookie/session. Check below steps for the same: 1) Add any item into cart, once you hit on add to cart button for any item. 2) Open second tab for same URL and check for add cart item count. You can see only one item added display but if you refresh the first one tab then you can see add to cart item count is now two ...


0

OK I found the issue. When directly entering myurl/wp-admin/admin-ajax.php?action= mdjm_update_addon_options into my browser window whilst logged in as an Administrator, I was getting the expected response of 0. However, when not logged in, or logged in as a non-admin, I noticed I was receiving "You do not have sufficient permissions to access this page". ...


0

Another Method is to add this code into functions.php (or in plugin), without need of require '/path/to/wp-load.php'... but it will not be as faster as SHORTINIT : // EXAMPLE function MyFuncion(){ if (isset($_POST['mynamee'])) { echo get_option('my_nm');} } //===================Then==================== //1) Execute directly MyFunction(); ...


0

This was very frustrating to figure out. I spent hours on this issue and discovered your problem is in this input: <input type="text" name="name" id="name" size="30" value=""/> Try changing the input field name to anything but "name", for example: <input type="text" name="user_name" id="name" size="30" value=""/>


2

Perhaps this solution will work: var flag_ok = false; $('#publish').on('click', function (e) { if ( ! flag_ok ) { e.preventDefault(); var url = shiftajax.ajaxurl; var shift = $('#post_ID').val(); var data = { 'action': 'wpaesm_check_for_schedule_conflicts_before_publish', 'shift': shift, ...


0

I figured it out myself thanks to this Q&A. The problem was with closures in loops. Can't really explain what happens but it works for me. jQuery(document).ready(function($){ $.ajax({ url: ajaxurl, data: { 'action':'ajax_action', 'post_id' : 18 }, success:function(data) { var hero ...


2

using wp_die(); at the end of AJAX function fixed the issue for me. e.g add_action( 'wp_ajax_my_ajax_function', 'my_ajax_function' ); function my_ajax_function(){ echo json_encode($myvar); wp_die(); }


3

To pass data from js back to PHP simplest way is use json_encode or, in WP, its wrappers wp_send_json, wp_send_json_error and wp_send_json_success. Usage example: On PHP side function get_latest_product_meta() { $post_id = (int) filter_input(INPUT_GET, 'post_id', FILTER_SANITIZE_NUMBER_INT); $post_id or wp_send_json_error(); // array_shift ...


0

The best solution I found was a small library. https://github.com/CalderaWP/dismissible_notice It is backward compatible till WordPress 3.8.


0

I think in your code you must add this line for ajax acting jQuery.ajax({ type : 'POST', url : '<?php echo admin_url('admin-ajax.php'); ?>', data : { action : 'vg_show_post_id', post_id: $post_id, data-id: true }, ),


0

wp_ajax_{my-action} action hook is only for admin side. For frontend you must use wp_ajax_nopriv_{my-action}. You can combina both if the ajax action is for both sides. For example: add_action('wp_ajax_filter_search', 'filter_search_result'); add_action('wp_ajax_nopriv_filter_search', 'filter_search_result'); Also, don't forget, never, to die or exit at ...


0

So, after hours of searching, I finally found where was my problem : another method in my class interfered with my ajax authentication system.


0

I think you need to start session at init action, find the piece of code given below.. may be helpful to you. :) add_action('init','vg_session_start'); function vg_session_start(){ if( !session_id() ) session_start(); } ...... your code.....


0

Not necessary, you echo the value on the traitement page, and in your ajax request, you get put the echo in a variable, like : resultats = ajax.responseText;


0

You cannot pass absolute URLs in WordPress. Use ajax_for_frontend.ajaxurl in place of absolute URL. Try using this (untested) - jQuery(document).ready(function() { var numberOfPromos = 4; jQuery.ajax({ url: ajax_for_frontend.ajaxurl, type: 'post', data: { action: 'get_number_of_promos', }, ...



Top 50 recent answers are included