<button id='0' value="23" name='process'>Click 0</button>
<button id='1' value="45" name='process'>Click 1</button>
<button id='2' value="66" name='process'>Click 2</button>
<button id='3' value="88" name='process'>Click 3</button>
<button id='4' value="92" name='process'>Click 4</button>
$('#id').click(function(){
$.ajax({
url: "test.php",
data: {0:123},
processData: false,
contentType: 'application/json'
});
});
I'm not very familiar with ajax but I want to use it to avoid reloading the page which is currently what is happening with the php I'm using. I need to send the data through ajax upon clicking one of the buttons. Each button needs to send a unique key (the id) and also a simple numeric value.
Not sure how this is done with Ajax exactly with respect to sending through unique pieces of information per click and how to trigger different results for different buttons.