jQuery AJAX request demo

by a13xs

HTML

<div class="div">
click
</div>

JavaScript

$('.div').on('click', function() {
console.log('click');
$.ajax({
	url:'myAjax.php',
	success: function (response) {
		console.log(data, response);
		$('#output').html(response);
	},
	error: function () {
		$('#output').html('Bummer: there was an error!');
	},
});
});