Solved it simply using:
$json = array();
$terms = get_terms( 'state' );
foreach ( $terms as $term ) {
$json[]=array( 'value'=> $term->name );
}
echo json_encode($json)
Related Posts:
- Jquery not showing in homepage
- jQuery ajax call throws an HTTP 302
- Sorting WP Auctions by date/price?
- jQuery tabs plugin with callback to fetch data
- AJAX Success Function using JS substr() fails in WP 4.1 vs 4.0
- jquery Autocomplete
- using jquery autocomplete in wordpress plugin
- JSON parsing error syntax error unexpected end of input
- jQuery dialog popup
- How to send multiple data fields via Ajax?
- Jquery Ajax Posting JSON to webservice
- How to fix the ‘Missing required request header. Must specify one of: origin,x-requested-with’ Ajax Error
- What’s the point of the X-Requested-With header?
- Slide right to left?
- Check if user is logged in using JQuery
- WordPress AJAX File Upload – FrontEnd
- Can’t get a JSON object in response to an Ajax request with wp_ajax
- Creating Ajax backend for Specialised Page Template? Should admin-ajax.php be used?
- Infinite scroll / lazy loading with NextGen Gallery [closed]
- wp_mail script with jQuery post
- WP set auth cookie using Ajax is not saved to browser
- jquery & ajax getting data to php in wordpress
- AJAX returns response 0
- Passing a varible from jQuery to PHP
- possible to make sections in theme customizer sortable and saveable at publish button clicked?
- ajax call in wordpress front end
- How to Use JSON With AJAX?
- wp_localize_script, variable is not defined in jquery
- Using wp_ajax and wp_ajax_nopriv hooks
- Enqueuing jQuery in plug-ins
- WP REST return value to error function from Request
- How do I get my page to load the jQuery UI Effects library?
- Ajax with jQuery UI dialog not working
- WordPress Ajax not function as I expect… what’s wrong?
- Accept AJAX call with serialized form data
- Loading posts via AJAX in a hidden div with updated URL?
- How to get a value from PHP in Jquery through Ajax
- Ajax not posting form data to query in PHP function
- jQuery Ajax returning correct Response, but after redirect to 404 Error
- How to get those data using with ajax json?
- Front-end Ajax File Upload
- Correct way to write jQuery functions in WordPress
- Format numeric symbols in titles
- gravity forms jQuery.load into modal [closed]
- jQuery.accordion isn’t a function even when enqueued
- splitting the URL using jQuery
- Why is on status span no search results?
- WooCommerce Ajax Cart Update Stopped Working
- WordPress AJAX Load More function duplicating a post
- AJAX Loaded Glossary like Search results with links to other entries from custom table
- Advanced Ajax Page Loader (AAPL) blocks resources
- First Attempt at AJAX and it keeps getting Canceled. Can’t Get Results to Show
- Dukapress jQuery(“form.product_update”).livequery is not a function [closed]
- Which jQuery packages are included in WordPress 3.1.2?
- Good Solution for Adding jQuery Tabs Anywhere Within WordPress?
- Cannot enqueue jQuery correctly using Google CDN
- How to return multiple arguments from AJAX callback function
- Adding jQuery UI elements to WordPress page
- Why use admin-ajax.php when loading pages through AJAX?
- WP Rest Api / Ajax POST not working when not logged in
- Ajax Validation for reCaptcha
- Jquery UI Google CSS, from where?
- datepicker for custom post type admin
- fill form fields with ajax response
- Adding custom cart price with Ajax in wordpress
- Null/undefined return in WordPress AJAX request
- Recommended Use of Bootstrap, or JQuery-UI in WP/plugin development?
- Manipulate retrieved ajax data in php
- Using Jquery submit with ajax request
- How to use wp_update_post with ajax on frontend
- Converting a working AJAX form to work with WordPress
- WordPress Front-End Theme Editor
- Drag and Drop Metadata Menu Order
- Ajax page load in wordpress the right way?
- jQuery UI Accordion loading very slow
- WordPress live search and filter
- Slide toggle Jquery UI
- why does so many javascript libraries are loaded along with my website?
- wordpress ajax upload media not working
- Dashboard controls have all stopped working
- Reload selected post in multiple post query with ajax
- $_POST empty in using new php file added to theme
- Passing variable data from external jQuery file to options.php
- How to specify url for ajax call in wordpress plugin
- Possibility of creating a folder in the wordpress root install and installing a file there, all via plugin?
- Call admin ajax using absolute url? Relative URL breaks (frontend ajax)
- Load more button
- Ajax autocomplete based on usercode
- Page keeps refreshing with Ajax form
- jQuery autcomplete not working
- Convert WordPress SACK code to new admin-ajax
- Get selected value with PHP and jQuery
- WordPress/jQuery pagination plugin for multiple lists
- Ajax request with jQuery without WP_ajax
- Ajax Query returns zero
- Dynamically populate Cascading Dropdown from MySQL using JQuery/AJAX [closed]
- How to combine jQuery in-place editor with $wpdb->update
- Theme variation conflict with jquery select2 dropdown
- Contact Form 7 – Submit Form not working After Ajax Request [closed]
- jQuery datepicker not showing on admin menu