Nonce in an AJAX request WordPress

Nonce in an AJAX request WordPress



var data = {
		action: 'my_action',
		security: '',
		my_string: 'Hello World!'
	};
	$.post(ajaxurl, data, function(response) {
		alert("Response: " + response);
	});




/*AND IN AJAX.php FILE*/
	check_ajax_referer( 'my-special-string', 'security' );