counts

by ilyautkin

HTML

<span id="count">6</span>
<button class="btn">Увеличить</button>

JavaScript

$(document).on('click', '.btn', function() {
      $.ajax({
        type: 'POST',
        url: '/echo/json/',
        data: {
          json: JSON.stringify({count: $('#count').text()*1+1}),
    	},
        success: function(msg){
          $('#count').text(msg.count);
          //window.location.href = msg.url;
        }
      });
      return false;
    });