This whole thing works as far as I can tell. In the future it may be easier to debug things by using PHP error_log()
to write to the debug.log
at certain points, like inside your ajax callback.
If you’re only wanting to run this ajax for logged in users, you can drop the wp_ajax_nopriv
hook and the is_user_logged_in()
conditional and just stick with wp_ajax_*
hook. wp_ajax_nopriv
is “No Privileges” which means it will run for non-logged in users. The normal wp_ajax
function will only run for logged in users.
The main issue is that your keys do not match the WordPress usermeta keys. You’re grabbing the inputs ID which is first-name
but WordPress expects first_name
as the metakey. I bet if you checked your databases uusermeta table, you’d see a couple instances of first-name
as a metakey.
Related Posts:
- Get selected value with PHP and jQuery
- JSON parsing error syntax error unexpected end of input
- Pass request headers in a jQuery AJAX GET call
- jQuery Ajax error handling, show custom exception messages
- How to send multiple data fields via Ajax?
- My javascript is returning this error: $.ajax is not a function
- Jquery Ajax Posting JSON to webservice
- Ajax TypeError: $.POST is not a function
- TypeError: $.ajax(…) is not a function?
- XML Parsing Error: not well-formed in FireFox but good in Chrome
- Ajax Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource
- 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?
- How to get a cross-origin resource sharing (CORS) post request working
- jQuery Form Validation before Ajax submit
- jQuery – Illegal invocation
- jQuery ajax error function
- How to manage ajax calls and JSON in wordpress
- ajax stopped working when not logged in?
- Using jQuery to delete data stored in wp_options
- WordPress AJAX File Upload – FrontEnd
- How to add a ” waiting” icon for an ajax in WP frontend?
- Can’t get a JSON object in response to an Ajax request with wp_ajax
- What is the simplest ajax upload plugin or script to be used with wordpress?
- AJAX nonce with check_ajax_referer()
- Creating Ajax backend for Specialised Page Template? Should admin-ajax.php be used?
- WordPress Ajax URL for function in functions.php
- Infinite scroll / lazy loading with NextGen Gallery [closed]
- wp_mail script with jQuery post
- Ajax call does not activate callback function
- AJAX call returns 0
- AJAX function returning -1
- call shortcode in javascript
- WP set auth cookie using Ajax is not saved to browser
- jQuery and AJAX Not working with Select Form Element
- How to pass both action and formdata in wordpress ajax?
- Is it possible to get the logged in username in a jquery script?
- jquery & ajax getting data to php in wordpress
- AJAX returns response 0
- jQuery AJAX form validation
- Passing a varible from jQuery to PHP
- Proper way to load a single post via Ajax?
- Basic WordPress AJAX Call
- Trying to get single posts to load on the front page via ajax
- ajax call in wordpress front end
- AJAX post into pop-up div
- Bind to WPSetAsThumbnail
- Ajax not firing properly using Firefox, but works in Chrome
- jQuery Ajax() doesn’t work when the page is accessed as a WordPress template page
- Appending anchor tag to next post
- How to Use JSON With AJAX?
- wp_localize_script, variable is not defined in jquery
- How to load whole WordPress pages dynamically with AJAX/jQuery like this following website?
- Using wp_ajax and wp_ajax_nopriv hooks
- WP REST return value to error function from Request
- Creating custom AJAX requests
- How to pass jQuery ajax URL value
- Registration e-mail check with AJAX
- Orderby post__in Not Working Correctly?
- Get ajaxForm response value
- wordpress ajax upload media not working
- How to pull data from a table using wpdb?
- Reload selected post in multiple post query with ajax
- Is not using admin-ajax to ajax submissions okay?
- jQuery.post() calling function with parameter
- $_POST empty in using new php file added to theme
- Autocomplete for titles via ajax – rework of past post away from like_escape()
- Passing variable data from external jQuery file to options.php
- How to specify url for ajax call in wordpress plugin
- Retrieve customizer value using ajax or customizer api and print the value in theme
- Possibility of creating a folder in the wordpress root install and installing a file there, all via plugin?
- Displaying contents of a tab
- owl carousel not working after ajax load [duplicate]
- WordPress version for this autocomplete jQuery code
- Call admin ajax using absolute url? Relative URL breaks (frontend ajax)
- Load more button
- Ajax Request with jQuery not happening
- Ajax autocomplete based on usercode
- Variable not being returned from Ajax Javascript (though javascript receives it)
- Page keeps refreshing with Ajax form
- jQuery AJAX add json2 dependency?
- How to respond with WP_Ajax_Response();
- How to pass more information though separate post keys via AJAX
- wp_signon not working fine and 302 moved temporarily?
- Loop not appending through infinite-scroll ajax call
- Convert WordPress SACK code to new admin-ajax
- how to refresh index page without reloading browser using ajax
- Ajax request with jQuery without WP_ajax
- Ajax Query returns zero
- jQuery form plugin, submit in the wordpress way
- Contact Form 7 submission does not complete [closed]
- Using WP Ajax and jQuery to process multiple forms on the same page?
- Combo box populating a DIV using ajax/jquery
- Dynamically populate Cascading Dropdown from MySQL using JQuery/AJAX [closed]
- Infinite Scroll applied to ajax loaded content
- How to combine jQuery in-place editor with $wpdb->update
- Load loop images on click / defer image loading until click or other event
- Widget won’t work due to old JavaScript? Any ideas how to make it work? [closed]
- Contact Form 7 – Submit Form not working After Ajax Request [closed]
- AJAX call not initializing for non-admins in WordPress