Add this to functions.php
add_action('wp_ajax_post_language','post_language');
and then make either of following changes in your code.
Because your jquery code is sending FirstNM to server (not FirstName).
Therefore in post_language() function, change this line
$FirstName = isset( $_POST['FirstName'] ) ? $_POST['FirstName'] : '';
to
$FirstName = isset( $_POST['FirstNM'] ) ? $_POST['FirstNM'] : '';
OR
Change 'FirstNM': FirstName, to 'FirstName': FirstName, in ajax call.
data: {
'action': 'post_language',
'FirstName': FirstName, // 'FirstNM': FirstName,
}
UPDATE:
Also remove this line,from post_language() function if yo have not defined alert() in your PHP It seems to be a JS function added to PHP by mistake, resulting in a PHP error.
alert('post_language is called');
Related Posts:
- Jquery ajax to custom php file: returning blank data
- Checking for new message using AJAX and PHP. Server overload?
- Live search from database table
- Ajax not updating to database
- How can I fetch loop of post titles via AJAX?
- Retrieve POST data from AJAX call
- WordPress Ajax always returns a 404 error
- problem with ajax and the path to the php page
- How to use wp_localize_script in a WordPress page other than functions.php?
- Real time Duplicate title check
- simple wordpress ajax plugin not working when not logged in
- Load custom field value into div with AJAX
- Update WordPress Custom Field with AJAX on cached page
- Targeting single page with JS
- Is the regular ajax request method safe or I should use admin-ajax.php?
- Use ajax to update_post_meta
- Click loads template via ajax
- AJAX in WordPress, sending coords data to MySQL and show after into map
- How to retrieve the content (with a specific ID) via ajax by clicking a link tag
- How to speed up admin-ajax.php in wordpress
- Returning a value from a PHP page
- Sending jsPDF documents to the server
- Ajax $wpdb not returning table data
- wp_insert_post() is returning the correct post ID, no failure, but the post content does not get updated
- How to test nonce with AJAX – Plugin development
- Woocommerce add to cart quantity buttons with AJAX
- class click counter save number
- AJAX request status 200 but no actual “response”
- Ajax load more posts with multiple tax query
- WordPress Sending data to Ajax with select option
- Ajax request not sending to server and returning – wp-admin/admin-ajax.php 400
- Why ajax doesn’t work on certain wordpress hooks and reload the page instead?
- AJAX pagination, update current page
- Save Search System
- adjust section according to country?
- dynamic dependent select dropdown
- Change “add to cart” button color based on Woocommerce product category [closed]
- Ajax request returns ‘Array’. How to output the actual results?
- How to add a do_action on refreshing of WP customizer?
- Show success or error messages in Ajax response to WordPress custom registration form
- How to add a Custom Mailchimp AJAX Newsletter Subscribe Form
- Plugins not working on AJAX requests
- Fancybox type popup window that’s not an iframe
- Can I use a jQuery Ajax request in Code Snippets Plugin for WordPress?
- How do I Import / Upload Files with jQuery AJAX?
- WordPress admin-ajax.php 400 bad request
- Pull GetOption() variable into jQuery dynamically created html
- Function won’t run onclick using Ajax
- How to keep track of when a vote is cast?
- WordPress plugin admin page – using WordPress function in linked php file
- jQuery Ajax PHP function call returning [object Object]
- Shortcode to pull posts
- Ajax search shows all results when user empties input?
- Why i can’t get custom fields value or post ID via Ajax?
- Get uploaded image and attach it to the new post
- Admin-ajax php not working on new wordpress version
- Proper way to use WordPress function with AJAX PHP file
- Add a counter for mouseovers (custom field)
- Accessing an API with jQuery and AJAX
- Change Query Arguments (filter) with jQuery/Ajax or PHP?
- How to set variables with AJAX request to use in another function in WordPress
- Search Ajax Call – Use Form Data in Response
- Why does PHP called with Jquery AJAX not allow additional php code to be added?
- Using Ajax to submit a form, and run a SQL Select query based on user input from the form
- Tracking Visitor LatLng with WordPress using JS, PHP. How to put data which was extract using JS into DB
- Database entry removed on browser refresh, Ajax PHP jQuery
- Failed to load resource: the server responded with a status of 500 (Internal Server Error) through wp_admin_ajax.php
- Ajax result show in console if is called outside function and not showing in array
- Ajax filter with loadmore button
- Admin-ajax.php 404 error
- How to pass values from one function to the other using an array variable
- How to change PHP variables with AJAX request in WordPress
- Can’t make lazy load for my site, help!
- wp_ajax_ 400 Bad Request
- update_post_meta Not Processing Array Data (Not Sure What I Am Missing)
- WordPress ajax filter returning all posts when it should be filtering by category
- Input field duplicates on form submit by jQuery
- How to echo a PHP code into WooCommerce variation product?
- How can i get the same ajax result using WP REST API instead of admin-ajax?
- How to call a function from functions.php with ajax?
- Custom theme admin-ajax.php 400 (Bad Request)
- number of posts with “Load More”
- Prepared DB Query from _POST array
- Find the method which AJAX GET calls
- AJAX Filter WHILE Loop not working WordPress
- WordPress AJAX load post metadata in modal
- Why I’m Not Having Access to “$_POST” Data Outside My AJAX Callback?
- ajax form with multiple submit buttons and values
- How to run ajax in WordPress Post?
- Adding instant search to wordpress page
- Add php function into .js file (for tinyMCE button)
- ajax form function error
- Load Meta box value into div AJAX [duplicate]
- notify users when changed database
- getJSON response to PHP
- ajax problems on loading page [closed]
- Help with AJAX request
- I got this error POST https://localhost/meraboilerwp/[object%20Object] 404 (Not Found)
- custom AJAX filtering logic and outputting results into an Elementor Loop Grid widget
- Trying to GET data with ajax from database and show in fullcalendar