ajax call too functions.php
var ajaxurl = 'https://example.com/wp-admin/admin-ajax.php';
$.ajax({
url: ajaxurl,
type: 'post',
data: { action: 'register_user' ,"username": "arshia"},
success: function(response) { console.log(response); }
});<?php
// ajax call to this function
function register_user()
{
$username = $_POST['username'];
echo $username;
die();
}
add_action('wp_ajax_register_user', 'register_user');
add_action('wp_ajax_nopriv_register_user', 'register_user');
?>
Also in JavaScript:
- how to get started with nodejs
- how to do radio button validation in jquery
- make indexOF in js
- openseamap nodejs github
- qrcode js
- array find method javascript
- round to decimal javascript
- set iframe height and width by js
- resolve vs return promise js
- what is npm global install
- js get object keys
- javascript string single or double quotes
- How to delete an item in an object in redux
- js promise examples
- if json then parse
- javascript enter event listener
- event after div created
- load_jsonl love jsonl
- iframe reload parent page
- node code comment process real time
- javascript disable scrolling
- vuejs use set to prevent duplicates
- formatDoubl js
- how to remove the last character from a string in javascript