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
- How to create new title and its description inside a section in WP Customizer?
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- Open Post Thumbnail in New Child Theme File in WordPress
- How to use get_theme_mod in gutenberg editor wordpress?
- How to get current post user id
- Simple ajax call not working in wordpress plugin
- How to Display a Plugin function (content) on frontpage using index.php
- AJAX search posts and pages
- __callStatic method handler passed to add_action causes bug in PHP
- Using a custom plugin to capture input data via Ajax and PHP
- Display post lists in 2nd paragraph
- Ajax contact form widget plugin data not insert in database
- Plugin options page with live preview?
- Best place for if/else piece of code related to custom plugin?
- Making sure that a plugin’s scripts and stylesheets are included for dynamicaly loaded content
- 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 .?
- Create tabs in admin options page from custom post type loop
- 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)
- How to write “alt” tag in image for wordpress code?
- WordPress front end AJAX. Return 0 :?
- Release the plugin in the WordPress repository where redux is used
- Using WordPress to build membership Page
- Shortcode Attributes to Return different $_POST
- How to use the CSS of the WordPress core in the development of my administration page?
- Asynchronous request in wordpress
- How to customize this theme? [closed]
- Is there a better way of handling AJAX requests in WordPress?
- Calling a class method instantiated by ajax call in wordpress [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
- Yoast SEO Plug In and my Theme duplicating code. Need some feedback on what to do? [closed]
- 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
- can’t unzip file
- require_once not working in plugin wordpress
- Elementor Sidebar not loading when PRO elements plugin is active
- Widgets are not displaying in the admin panel
- wp_query ‘s’ parameter does not work with WC_AJAX
- wc_get_template_part doesnt display the content [duplicate]
- How to override any plugin file in the child theme
- submit two file input fields in the same form
- Content-Security-Policy implementation with WordPress W3Total Cache plugin installed
- Error datatable whit ajax
- woocommerce: Customize email with item total count
- Child theme modifications not showing up
- Rename a folder via HTML POST request
- How can I see $post object in frontend from functions.php?
- How to use Datatable with Ajax when creating plugin on WordPress?
- 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]
- WordPress panel is not loading after plugin activated with error: HTTP ERROR 500
- 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]
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- Overwriting Plugin’s Ajax callback function from theme
- Help Code Review – I need to write on .htaccess file from theme’s function.php
- My ajax request don´t work and return 0
- WordPress environment not loading properly
- how to add custom css at top above all css file for specific url
- 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
- How to copy data from user profile page (profile.php) to theme customizer
- What’s the preferred method of writing AJAX-enabled plugins?
- Ajax, jQuery and WordPress
- How to show post attachment image
- How to get site homepage from plugin?
- 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]
- Capturing POST data
- Breadcrumb is not generating the correct post page url
- Help me with my first very basic plugin
- Site is setup statically – how to make it content managable?
- How can I make a website with dynamic features with wordpress?