Note that there are some explanatory texts on larger screens.

plurals
  1. POWordpress admin-ajax.php Failure
    primarykey
    data
    text
    <p>I have a couple AJAX requests being used in a theme options page. Both worked just fine before, but now the first works and the second fails every time - the failure looks like this in Firebug: <a href="http://cl.ly/1w5u" rel="nofollow noreferrer">http://cl.ly/1w5u</a> and this is in Webkit: cl.ly/1wYn. I'm not getting ANY response of any kind. The thing is, the first one works just fine.</p> <p>Here's the JS (jQuery) that submits:</p> <pre><code>jQuery('.cropimage').click(function(){ var pid = jQuery('#tump_header_img').val(); var path = jQuery('#header_img_edit .container img').attr('src'); var dimensions = jQuery('#tump_header_img_position').val(); var security = jQuery('#_ajax_nonce_crop_apply_image').val(); jQuery.post(ajaxurl, {pid: pid, action: 'crop_apply_header_image', path: path, dimensions: dimensions, security: security}, function(response) { console.log(response); }); }); </code></pre> <p>ajaxurl is correct, it's the exact same URL used in the request that does work. I've tried stripping out everything and just trying to get a response, to no avail.</p> <p>The good stuff in functions.php:</p> <pre><code> add_action('wp_ajax_crop_apply_header_image', 'crop_apply_header_image'); function crop_apply_header_image() { check_ajax_referer('crop_apply_header_image', 'security'); $data = $_POST; unset($data['security'], $data['action']); $dimensions = explode(',',$data['dimensions']); $extension_pos = strrpos($data['path'], '/'); // find position of the last dot, so where the extension starts $newpath = substr($data['path'], 0, ($extension_pos +1)) . 'cropped-' . substr($data['path'], ($extension_pos + 1)); update_option( 'tump_header_img_path', $newpath ); die( wp_crop_image($data['pid'],$dimensions[0],$dimensions[1],$dimensions[2],$dimensions[3],940,200) ); } </code></pre> <p>Anyways - it gets to none of this as far as I can tell. I don't know what's wrong, any help is greatly appreciated!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload