$("#click").on("click", function doCount() {
var counter = document.getElementById('counter');
counter.innerHTML = +counter.innerHTML + 1;
$.ajax({
url: 'purple.html',
data: {'counter': counter},
type: 'POST',
});
<form>
<button type="button" class="button_p" name="choose_purple" onclick="doCount()" id="click"><h1 style="color: #331c2a">Choose</h1></button>
<p>Всего попыток: <span id="counter"></span></p>
</form>