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 equivalent of JavaScript’s addEventListener method
- Uncaught TypeError: Cannot read property ‘length’ of undefined
- How to send multiple data fields via Ajax?
- Adding an onclick function to go to url in JavaScript?
- Checking a Url in Jquery/Javascript
- AJAX response error: net::ERR_EMPTY_RESPONSE
- How is JavaScript .on() method defined?
- JQuery: $.get is not a function
- How to prevent wordpress from loading old versions of jquery in wp_head();?
- How to get a jQuery script to run on a page?
- WP set auth cookie using Ajax is not saved to browser
- ajax call in wordpress front end
- wp_localize_script, variable is not defined in jquery
- Hide/show customizer controls based on other settings in Customizer
- Jquery not showing in homepage
- AJAX request status 200 but no actual “response”
- Save Search System
- dynamic dependent select dropdown
- Limit filetype and wp media
- How to isolate code to the post edit screen
- wordpress add_action() issue in ajax call
- Disable Cloudflare Rocket Loader for jQuery javascript and make it load first
- wp_mail doesn’t work when logged in?
- Call current post URL in ajax
- jQuery selectable() function won’t work in wordpress
- Null/undefined return in WordPress AJAX request
- How To Include JavaScript Files Only In Single Posts?
- How to display contact form 7 form in vanilla js without jquery in frontend
- Display full WordPress post under search form using AJAX
- WordPress AJAX Request returns 400
- Admin-ajax.php 404 error
- Ajax sometimes work and sometimes just don’t work
- AJAX POST Value not being returned – WordPress – AutoTrader API
- Javascript output now showing in custom widget
- Many buttons not functioning in WordPress dashboard (as admin)
- why does so many javascript libraries are loaded along with my website?
- Why does my media selection script write to ONLY the first input field?
- Modify the href attribute of tag dynamically in WordPress
- Move jQuery on *top* of footer
- JQuery and Javascript to pan image
- How to add JS snippet before closing tag?
- Call admin ajax using absolute url? Relative URL breaks (frontend ajax)
- Page keeps refreshing with Ajax form
- Ajax request with jQuery without WP_ajax
- JS file not loading [closed]
- JSON Object Value Show Undefine