Uncaught TypeError: Cannot read property ‘ajax’ of undefined
@Sasa1234, it happen cause your jQuery is undefined. Please take a look @EAMann answer. So, your JS code should like this:
function myajaxfunction() {
if ( undefined !== window.jQuery ) {
jQuery.ajax({ //ajax request
url: ajaxurl,
data: {
'action':'rs_like_request',
'post_type' : jQuery('#post_type').val() // value of text box having id "post_type"
},
success:function(data) { //result
jQuery(".showdiv").html(data); //showdiv is the class of the div where we want to show the results
},
error: function(errorThrown){
console.log(errorThrown);
}
});
}
}
Related Posts:
- Ajax form submission from admin panel
- How to securely add an Ajax button to a WP Admin page?
- wp_remote_get() to get AJAX url /wp-admin/admin-ajax.php
- AJAX requests broken due to HTTPS for wp-admin
- wp-admin AJAX with Fetch API is done without user
- WP Admin AJAX Security – using POST to include a relative URL
- Why a strange discrepency between get_current_user_id() when using AJAX versus output of document.cookie?
- Pass additional parameter with async upload
- Use WP admin AJAX url to hide API key
- Preprocess submitted data
- How to check nonce lifetime value of plugins?
- Use AJAX in a WordPress Plugin to Get Data From Custom Database?
- admin-ajax.php returns 0 even when the post status code is 200 OK
- Can I use application/json content type in WordPress
- wordpress admin ajax trash_comment
- Ajax call not working anymore
- WorddPress website admin part not working correctly – I think ajax/json issue
- How modify comments metabox on post edit screen in WordPress?
- Weird admin-ajax.php problem
- WordPress Get Header and Footer using in Admin Area
- get_comments() returns empty array if called through AJAX
- WordPress blocking polling request when signed into Admin
- randomly get 400 error while user is logged in wp_ajax
- Access-Control-Allow-Origin error sending a jQuery Post to Google API’s
- JavaScript implementation of Gzip
- WordPress AJAX with Axios
- Why might a plugin’s ‘do_shortcode’ not work in an AJAX request?
- Get Previous & Next posts by Post ID
- Nonces and Cache
- REST API endpoint for elasticpress autosuggest
- ajax – why multiple calls to wp_create_nonce() return same value?
- AJAX request on the frontend always returns 0 if user is not admin
- Using ajax on categories and wordpress loops
- Don’t allow access to wp-admin but allow admin-ajax requests to be fulfilled on frontend?
- How to modify wp_ajax function?
- Turn jQuery.ajax() request into XMLHttpRequest (vanilla JavaScript)
- Can’t seem to get wp_localize_script to work
- Ajax – gettext without a plugin
- 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
- update_user_meta doesn’t work with AJAX
- Ajax stops working when logged in?
- WordPress ajax get content post id
- Using wp_handle_upload and media_handle_sideload with ajax
- Create Page With wp_insert_post() and AJAX
- Load ajax if is_home()
- How to know what page is calling admin-ajax.php?
- Populate a Map at The Same Time as showing Posts via AJAX
- wp_localize_script not working on ajax response
- Get wp_title wp ajax
- Loading post template that contains a nested loop with ajax
- Code run fast on a cronjob but slow with a do_action or ajax call
- How to export custom database data to excel file
- Ajax comment form submit on frontpage alerts success but no insertion
- How to update Comment post meta through an Ajax call
- ModSecurity && Admin Ajax: Server locking up
- Wp mail does not work when Ajaxed to
- MySQL select query with ajax
- Bad request 400 from custom ajax call
- 400 Bad Request, in wordpress theme development, wp_ajax
- Get response for check_ajax_referer
- WordPress ajax-action how to return content
- Custom Login with Ajax not working with IE
- AJAX jQuery post frontend returning failed to load resource status 400
- ajax form is returning the dreaded “[HTTP/1.1 400 Bad Request” and a zero
- How can I wp_send_json data?
- Front end theme options ajax returns 0
- Custom RPC end-point security best pratice?
- AJAX – SHORTINIT set to TRUE returns blank
- How to make image in TinyMCE clickable
- How to use Jeditable plugin with admin-ajax.php?
- Ajax mousedown call getting “cancelled” when clicking link
- Uncaught TypeError: Cannot read properties of undefined (reading ‘message’) [closed]
- Disabling ajax code that does a POST request that ends in a 400 error code
- Add Server Side validation in Ajax mail form
- How to prevent my external API call from being called by anyone but me (my site)
- Ajax not sending the data correctly- Multidimensional array
- Registration form AJAX check for existing username (simple version)
- All WordPress AJAX calls always return 0
- Trigger action via button
- Syntax error on query_vars while handling with Jquery
- Want to send ajax request in wordpress to a custom file in plugin
- 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
- Sending email with wp_email and AJAX
- How to use nonces for frontend AJAX voting if the page gets cached?
- AJAX Call in Plugin Returns More than JSON
- Ajax Form seems to post, but does not return
- Objects and get_post_meta() gives me 1 string for latitude and longitude
- Why can wordpress not find the actions I add in my constructor?
- delete attachment for one post without deleting actual attachment post
- Memberpress isn’t cooperating with WooCommerce
- wp_editor() in content that was loaded with ajax [duplicate]
- Facebook Pixel + WooCommerce + AJAX = Confusion
- How to get data with Select AJAX PHP
- Bad Request 400… jQuery ajax post of json data to wordpress admin-ajax.php
- How to submit a button automatically after every scheduled hours?
- At what stage does wp_ajax hooks gets applied during WordPress request?