I have made some changes to your code. See now if this works –
function myajax_inputtitleSubmit_func() {
// check nonce
$nonce = $_POST['nextNonce'];
if ( ! wp_verify_nonce( $nonce, 'myajax-next-nonce' ) )
die ( 'Busted!');
$zipcode = $_POST['zip'];
// generate the response
global $wpdb;
$tablename = "{$wpdb->prefix}levering";
$sql = "SELECT Levering FROM {$tablename} WHERE Zip LIKE %s";
$result = $wpdb->get_col($wpdb->prepare($sql, $zipcode));
$response = array();
foreach($result as $res){
$response[] = $res;
}
// response output
echo json_encode($response);
die();
// IMPORTANT: don't forget to "exit"
exit;
}
Related Posts:
- Sql formatting for post data within function
- Counting Posts with multiple taxonomy and terms condition using MySQL and AJAX
- How to call a PHP function with Ajax when the user clicks a button
- Delete row of custom table in WordPress using AJAX
- Updating a checkbox value to database for specific row in table
- Ajax insert or update data
- Creating an auto result search bar
- Ajax call in wordpress not working for subscriber user
- Use AJAX in a WordPress Plugin to Get Data From Custom Database?
- WordPress ajax response save into database
- Not getting ajax success response on insert/update row to database
- AJAX is not submitting data to database
- AJAX call in backend results in empty update_option
- Ajax Form data is not posted back to the get_results()
- Can’t access data from database using AJAX
- Translating wordpress foreach to ajax
- WordPress Ajax – looping data into a table
- $wpdb Ajax not redirecting to main page
- Adding custom fields to Wired Impact Volunteer Management Plugin
- Successful ajax call returns lots of whitespace and text of code with 0
- Using $.ajax getting 500 error
- JavaScript implementation of Gzip
- How to cache json with wp-super cache
- Use wpdb->prepare for `order by` column name
- AJAX request on the frontend always returns 0 if user is not admin
- wpdb->prepare function remove single quote for %s in SQL statment
- Admin Notification after save_post, when ajax saving in gutenberg
- Cannot load admin-ajax.php. No access-control allow origin*
- Initialize JS with an ajax loaded ACF form
- WordPress Nonce Issue for Ajax Login and Logout
- How to modify wp_ajax function?
- Nonces and Ajax request to REST API and verification
- Vue.js + AJAX Shortcode
- Turn jQuery.ajax() request into XMLHttpRequest (vanilla JavaScript)
- Is there a (better) way to access $wpdb results?
- wp_ajax action is not running
- WordPress AJAX calls not detecting language properly?
- AJAX issue – Uncaught SyntaxError when processing Zip File
- wp_verify_nonce doesn’t return true on server when it matches the nonce
- get posts and postmetas in assoc array
- How do I set the url to make an ajax request for a html document?
- wp-admin AJAX with Fetch API is done without user
- Ajax stops working when logged in?
- WordPress ajax get content post id
- Need help writing a $wpdb query
- Populating content dynamically via AJAX and Advanced Custom Fields [closed]
- wpdb_prepare with multiple or condition
- Create Page With wp_insert_post() and AJAX
- Get wp_title wp ajax
- update_post_meta using ajax
- How to export custom database data to excel file
- Ajax comment form submit on frontpage alerts success but no insertion
- Create table from array with prepare
- Wp mail does not work when Ajaxed to
- Exposing data using a custom WordPress API
- Increment integer field in database when WHERE needs to be dynamic [closed]
- Make a SQL query with wpdb in WordPress
- Custom $wpdb returns unexpected time based results
- Custom Login with Ajax not working with IE
- 400 Bad Request when sending XHR from React.js to admin-ajax.php
- Making POST request with AJAX returns a 400 error (without jQuery)
- How to delete a particular row in a database table
- Front end theme options ajax returns 0
- Load image src through Ajax by ID?
- Using get_theme_mod in php ajax form doesn’t work
- PHP session when called wp_ajax_nopriv
- What exactly does ‘authenticated’ mean for wp_ajax_nopriv?
- Custom RPC end-point security best pratice?
- How to use Jeditable plugin with admin-ajax.php?
- Ajax mousedown call getting “cancelled” when clicking link
- WordPress Ajax Not Firing
- Get uploaded attachment width & height and attachment ID after upload them
- Refresh checkout fields on add to cart with order bump
- Add Server Side validation in Ajax mail form
- WordPress SQL Prepare
- Is it good practice to use REST API in wp-admin plugin page? [closed]
- Ajax not sending the data correctly- Multidimensional array
- get a bad request 400 on my ajax-admin.php file
- Help posting values to DB on submit using $wpdb->query
- How to check Ajax request only when i opened the Notifications list?
- All WordPress AJAX calls always return 0
- Want to send ajax request in wordpress to a custom file in plugin
- How to send the checkbox value to email
- how to get password from user instead wp-generate-password
- Class called in template, AJAX not registering
- Same query in category.php and in function.php, but different result
- How to use nonces for frontend AJAX voting if the page gets cached?
- Ajax take too long to return code
- problem when adding wp_editor with ajax [duplicate]
- Get wp-load.php PATH with wp_localize_script and JavaScript for plugin
- Ajax Form seems to post, but does not return
- Ajax request to admin-ajax.php and window.location.href
- Objects and get_post_meta() gives me 1 string for latitude and longitude
- Memberpress isn’t cooperating with WooCommerce
- where does my function output from load-* go?
- WordPress ajax requst returns zero
- wp_editor() in content that was loaded with ajax [duplicate]
- WordPress blocking polling request when signed into Admin
- Send button using own contact form [closed]
- wordpress ajax bad request 400