Your problem is probably because you do not return a json object but an html (actually mixed text and html), and you set jQuery to validate that the response is json, which it isn’t.
your code at the ajax handler should be something like
$catshtml = wp_dropdown_categories(.....echo=0);
$ret = array('data' => $catshtml);
wp_send_json($ret);
die();
on the browser side you need to look for the content of the data attribute of the json element you receive from the server.
Debugging tip: always look at what is actually transmitted as a response in the browser developer tools section first before starting to rely on the consol log.
Related Posts:
- How to integrate plugin in WordPress theme
- WooCommerce get_price returning wrong price when used via ajax
- What’s the right way to implement functions in footer.php
- when i activate my WordPress plugin cannot see customizer options or preview
- What’s the preferred method of writing AJAX-enabled plugins?
- What is the correct way for a theme to support plugin UIs?
- How to call “page specific menu items” in template [closed]
- Update Multiple Post Meta for the Same Post In One call?
- Function to activate WordPress theme inside a plugin
- AJAX Call Via Vanilla JavaScript In WordPress Plugin Development
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- How to load a new template page according to a particular URL?
- Errors while using ajax from external wordpress page
- Should I use RIPS tool to test my themes and plugins?
- Built in admin ajax hooks?
- Ajax call doesn’t work in frontend but it’s working in backend (when I’m logged in)
- How to Build a Movie Library in WordPress 3.x
- Why is my ajax call refreshing the page?
- Admin-ajax.php is dying “0” without processing function
- How to remove an Ajax action
- Display future posts?
- How to create popup same as wordpress popup feature
- Only execute jQuery function(on document ready) on the page has shortcode from plugin [duplicate]
- Having separate plugins and themes folder for multi-site setup
- How can I get full attachment url from wp_get_attachment_metadata?
- unzip a folder on specific location and delete the zip file
- gallery option is not available in media upload box in costum theme option page
- Hide Theme options and Customize Admin menu
- Why is the Settings API is not saving my array of options
- Check if email address exists front end with AJAX in a plugin
- Open Post Thumbnail in New Child Theme File in WordPress
- How to use get_theme_mod in gutenberg editor wordpress?
- How to Display a Plugin function (content) on frontpage using index.php
- AJAX search posts and pages
- Plugin options page with live preview?
- Best place for if/else piece of code related to custom plugin?
- What are the specifics of WordPress development I need to know? [closed]
- Ajax call returning 0
- How to create a code editor for my plugin .?
- WordPress plugin admin html being shown in Customizer iframe
- wp_footer hook only working on homepage not in other pages
- remove add new post, if there is already one post
- What are the Best Practises When Using AJAX in Plugin Development?
- Redirect to another page using contact form 7? [closed]
- How do I combine a theme with a plugin
- how to force tag page layout to use same as search layout?
- Admin AJAX doesn’t work in plugin admin page – Even though code is copied verbatim from WordPress Codex
- Great blogs site resources/tutorial for WordPress Developers? [closed]
- Submit Form data to another page via Ajax (WordPress Way)
- Release the plugin in the WordPress repository where redux is used
- Using WordPress to build membership Page
- How to use the CSS of the WordPress core in the development of my administration page?
- How to customize this theme? [closed]
- Don’t load the theme for a page FROM a plugin EDITED
- Extending a theme: build new features as plugin or core modules?
- Remember the Meta Value With Radio Buttons
- How do you create a re-useable HTML fragment in wordpress
- WordPress plugin with its own “site”/theme
- Ajax request sends url rather than data
- best way to run a php script away from the template?
- Seperate plugin and theme files
- Xamp installed local wordpress not allowing to publish or install plugin
- Elementor Sidebar not loading when PRO elements plugin is active
- Widgets are not displaying in the admin panel
- wc_get_template_part doesnt display the content [duplicate]
- Content-Security-Policy implementation with WordPress W3Total Cache plugin installed
- woocommerce: Customize email with item total count
- Child theme modifications not showing up
- How can I see $post object in frontend from functions.php?
- AJAX update fails for public/non-admin users
- WordPress Ajax request “Failed to load resource: the server responded with a status of 400 ()”
- WordPress ajax error 400 bad request for sending data to remote site [duplicate]
- Remove action added in plugin class from theme
- ajax voting for custom post type
- Can you develop themes and plugins while using the hosting services BlueHost? [closed]
- Help Code Review – I need to write on .htaccess file from theme’s function.php
- WordPress environment not loading properly
- Where do the section input fields values are stored in database
- wordpress ajax pagination object value does not change
- Why the output of an image gallery plugin is not displayed into a page of my custom theme?
- How can I use wp_ajax_response for front-end error reporting?
- How to limit each front-end user to view just his own uploaded files on Amazon S3?
- WordPress ajax not working in registration
- What’s the preferred method of writing AJAX-enabled plugins?
- How to show post attachment image
- Can anyone tell me why I can’t edit a plugin when it is installed without having to re-install?
- What is the Object for WP_Error Class?
- Active Plugins for current blog in WP Multisite Network? [duplicate]
- Help me with my first very basic plugin
- Site is setup statically – how to make it content managable?
- How to generate a responsive output from plugin?
- How to create post comparison in wordpress
- Jquery post responses 500 error after some time and lastly an 503 error
- How to escape html code?
- manage_{taxonomy}_custom_column not working
- How to Enfroce Domain Licensing Limits? [closed]
- add_meta_box showing blank screen in my page
- How to create an Info Box on WordPress [closed]
- How to make content as required in custom post type?
- What are Seeds? [closed]