Usually, you can use the global variable ajaxurl instead of any path using admin-ajax.php.
More importantly, the PHP function should echo the response before calling wp_die(). Because you haven’t called wp_die(), AJAX is probably waiting for more from PHP.
Hope this helps.
P.S. What is that 'json' string doing where the AJAX fail() function should be?
Related Posts:
- Can’t get a JSON object in response to an Ajax request with wp_ajax
- JSON parsing error syntax error unexpected end of input
- My javascript is returning this error: $.ajax is not a function
- jQuery AJAX cross domain
- Jquery Ajax Posting JSON to webservice
- TypeError: $.ajax(…) is not a function?
- SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
- Javascript : array.length returns undefined
- Infinite scroll / lazy loading with NextGen Gallery [closed]
- Ajax call does not activate callback function
- AJAX returns response 0
- Trying to get single posts to load on the front page via ajax
- Ajax not firing properly using Firefox, but works in Chrome
- Using wp_ajax and wp_ajax_nopriv hooks
- Cannot access elements of json object
- Admin wp_ajax hook returning 0
- wp_ajax unauthenticated and authenticated
- WordPress ajax function parameter value not being passed
- WP Admin missing icons, numerous JavaScript errors, but only when SCRIPT_DEBUG is false
- WordPress customizer refresh screen after save
- Loading posts via AJAX in a hidden div with updated URL?
- Can’t load a class into WordPress post editor’s content field
- JSON output returns page source code [closed]
- How to get those data using with ajax json?
- Correct way to write jQuery functions in WordPress
- Intergrating agile carousel to wordpress: how to write the ajax_callback function
- WooCommerce Ajax Cart Update Stopped Working
- How to Dynamically Load Content Into Body of Bootstrap Modal Window?
- I want to import my Json file into a custom made display-modal. How do i link my Json file?
- Trouble with WordPress Ajax Login System – 302
- Using WP_Query to grab custom meta values, foreach to json object
- videopress videos are not displayed when loading the content with ajax in a lightbox
- How to return multiple arguments from AJAX callback function
- url – ajax loaded but no JS
- Using Foundation 5 in WordPress Administration Area
- Ajax Validation for reCaptcha
- Properly embed javascript into WP (using function.php) – doesn’t work?
- How to retrieve WP_Object that is inside an array of another array
- Custom AJAX form not working async
- Can’t add classes using jQuery from a JSON string with get_body_class()
- AJAX Success Function using JS substr() fails in WP 4.1 vs 4.0
- Parse wordpress blog data using json api and ajax
- Screen Options JavaScript Code
- Is there some jQuery conflict here?
- Ajax page load in wordpress the right way?
- Orderby post__in Not Working Correctly?
- Get ajaxForm response value
- Is not using admin-ajax to ajax submissions okay?
- Retrieve customizer value using ajax or customizer api and print the value in theme
- Displaying contents of a tab
- Uncaught TypeError: undefined is not a function (shortcode-box)
- jQuery AJAX add json2 dependency?
- Pass a PHP variable (loop-audio.php) to jQuery function (js/script.js)
- Widget won’t work due to old JavaScript? Any ideas how to make it work? [closed]
- JQuery UI Autocomplete/Autosuggest WordPress
- How to show custom fields in modal in category page
- Cross-Origin Read Blocking (CORB)
- Can JavaScript connect with MySQL?
- how to loop through JSON array in jQuery?
- How can JavaScript save to a local file?
- Turn jQuery.ajax() request into XMLHttpRequest (vanilla JavaScript)
- Updating User Profile with AJAX not working
- Display notification only once
- Auto Load New Posts
- Showing Author Information and Latest Post by author in lightbox when clicked on the name of the author
- Returning content via jQuery without footers on admin pages
- How to embed JS data viz in a simple WordPress website
- Why use admin-ajax.php when loading pages through AJAX?
- WP Rest Api / Ajax POST not working when not logged in
- Admin side jquery is not loaded
- “JQMIGRATE: Migrate is Installed” How do I find the problem code? [duplicate]
- Referrer URL with jQuery or Javascript – Cache & Referrer URL Issue
- Sorting WP Auctions by date/price?
- oEmbed Video in Modal
- Using Jquery submit with ajax request
- wordpress before or after javascript problem
- Using jQuery .after inside loop
- Jquery POST Ajax Return null data in wordpress
- Ajax Call not Working in Plugin
- Update $wpdb query with AJAX
- I am trying to Implement a Code that is Working in my previous page but not working in WordPress for some reason
- How to use $ with externally loaded javascript
- Getting click on item to open closest relevant element (popup) with jQuery
- Download doccument on server rather than clients browser
- WorddPress website admin part not working correctly – I think ajax/json issue
- wordpress ajax upload media not working
- How to avoid appending “null” in Ajax?
- AJAX Filter WHILE Loop not working WordPress
- Automatic add space if user enters number(any digit)
- Why I’m Not Having Access to “$_POST” Data Outside My AJAX Callback?
- How to get this jQuary script working?
- Youtube Iframe Api play one video at a time
- Possibility of creating a folder in the wordpress root install and installing a file there, all via plugin?
- Disable drag metaboxes, create many functions using js not to work!
- Customize wp-admin form custom fields
- Why wp_ajax hooks doesn’t work?
- jQuery ajax empty exeption on wordpress
- Ajax Query returns zero
- Adding jquery using php function
- AJAX call not initializing for non-admins in WordPress