The following wasn’t wrong for me:
$data = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $dbtable WHERE name = $name" ) );
It should be:
$data = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$dbtable} WHERE name = %s", $name ) );
Then you can just die();
at the end of the function like:
if( count( $data ) >= 1 ){
die( 'true' );
} else {
die( 'false' );
}
Related Posts:
- ajaxurl not defined on front end
- Using Ajax call in jQuery doesn’t work in widget
- Admin-ajax.php appending a status code to ajax response
- Ajax in WordPress – path issue
- how to search users by ajax live search
- jquery & ajax sending data to php
- Ajax submit result opens in admin-ajax.php
- insert query on a custom table using ajax with jQuery plugin Jeditable
- Ajax: Populate with content from a post’s ID not working – duplicating current page html instead
- Data not insert and update through ajax and jQuery in admin page?
- WP ajax requests not stacking?
- ajax working when function is on child theme but not in plugin page
- Ajax +wordpress onClick link redirect to new page and create html content
- Get cat parameter from admin-ajax
- Ajax on the Administration Side of plugin – returns 0
- WordPress Ajax not returning Response
- wp_ajax add_action fuction won’t fire on custom jQuery action
- Filterable posts using categories
- How to get values from Tinymce visual editor popup?
- WordPress function is not called and ajax return 0
- Ajax call not working with
- Page reload occurs before request finishes
- How to add a javascript snippet to the footer that requires jQuery
- How to include jQuery and JavaScript files correctly?
- How Do I Use jQuery UI In My Plugin
- Remove profile picture option (and other things) from profile.php (in admin)
- How can I run AJAX on a button click event?
- Test to see if jQuery or Prototype is queued by another plugin?
- What is nonce and how to use it with Ajax in WordPress? [duplicate]
- Empty POST data on server on AJAX request using Angular $http
- jQuery in header or footer
- Hook the Keydown Event in the TinyMCE Post Editor
- Build path for a custom portfolio plugin
- Add a jQuery function to admin pages
- Using AJAX in a plugin to submit form – REALLY confused
- wp_localize_script $handle
- Help adding image upload functionality to widget
- How to post form in ajax mode and handle it in wordpress
- WP_LOCALIZE_SCRIPT doesn’t work
- Cannot search post by taxonomy
- WP AJAX is not working, always returns 0
- Loading jQuery and jQuery plugin script files correctly [duplicate]
- wp_insert_post() is returning the correct post ID, no failure, but the post content does not get updated
- Slow WP_query due to nested wp_query. Need Suggestions
- Woocommerce checkout update totals with datepicker
- Including the necessary functions for a custom ajax registration form
- How can I rewrite a URL to pass requests to a custom method via AJAX? (I can’t use admin-ajax.php)
- Dashboard – get status and position of metaboxes and pass them to ajax method
- Ajax contact form widget plugin data not insert in database
- Storing data in wordpress database from ajax call from different website
- javascript datatables in a plugin
- Create custom HTML/JS app inside page
- Hide shortcodes “code” when using the “editor” the same as wordpress do with “gallery”
- wp_localize_script is not adding a global variable for javascript
- should i be checking for jquery before enqueing it in a plugin
- Remove entire [$key] from array stored in custom field using Ajax – unset($array[$key]); not working
- jQuery instantly executes (a button click and css change) on load
- Ajax is not working in a loop
- How to get error object returned by wp_create_user
- How do I get rid of my inclusion race-condition on wp_enqueue_script
- Issues Updating Post Meta with AJAX (Seems simple but cannot figure it out)
- AJAX call to admin-ajax.php by subscriber returns home page
- Ajax function is not working on WordPress
- About a programming language starts with [closed]
- Workflow for new importer plugin – your advices?
- Use options to control jQuery plugin
- How to localize data array in plugin’s option page
- sanitizing/escaping plugin options
- Using jQuery prepend() with file include
- wc_get_template_part doesnt display the content [duplicate]
- How to do admin ajax request in a plugin for rest api
- Ajax action has 200 status but response of No response data available for this request
- WordPress Does not grab the string sends useing AJAX response, wp_ajax hook
- Query String Filtering API
- Posts form with AJAX request – Plugin development
- Bad request 400 using class based files
- Trying to run a Ajax request from a checkout form in woocommerce via a custom plugin
- jQueryUI draggable doesn’t work in WordPress plugin
- WordPress Jquery with heade and footer sritp plugin
- 400 Bad Request and illegal invocation in wp_ajax based on processData set to false or true
- Rate limiting ajax requests in WordPress
- ajax-action.php can’t find added action
- AJAX call of function containing javascript which is not loaded (Plugin development)
- WordPress Ajax request “Failed to load resource: the server responded with a status of 400 ()”
- ajax multiple Values
- How to include files in the loop via ajax
- How to handle ajax Request in a complex-structured plugin?
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- Overwriting Plugin’s Ajax callback function from theme
- Ajax Response Error | just getting error as the response
- defined (‘ABSPATH’) false after AJAX post to other PHP-file
- PHP includes with AJAX actions
- admin-ajax.php returns “No Script Kiddies!” sometimes
- Ajax functionality not being called under wordpress plugin
- How can I add the Post ID to Class Name in Jquery?
- WordPress plugin: admin-ajax.php not passing data to custom function
- Ajax, jQuery and WordPress
- How to get site homepage from plugin?
- PHPUnit Ajax Serialization of ‘Closure’ is not allowed
- Return custom product in ajax call loop