you need use ajax for that. You can use jquery library for ajax communication. example like
function getData(){
$.ajax({
type: "POST",
url: "test.aspx",
data: { name: "John", location: "Boston" }
}).done(function( msg ) {
alert( "Data Saved: " + msg );
});
<input type="text" id="txtId" onchange="getData()" />
You need to add jquery ajax library to your page/masterpage/site. You can also use CDN.