<div>
<form method="post" action="">
<input name="" id="NewName" placeholder="Название" required/>
<button onclick="sendN(this)" class="NN" name="SaveNewTname">Сохранить</button>
</form>
</div>
function sendN(Ob){
var k = document.getElementById('NewName');
$.ajax({
type: "POST",
url: "http://site.com/getData.php",
data: "ID="+Ob.name+"&value="+k.value,
cache: false,
success: function() {
window.location.reload();
}
});
}
function sendN(Ob){
var k = document.getElementById('NewName');
var data = {
ID: Ob.name,
value: k.value
};
$.ajax({
type: "POST",
url: "http://site.com/getData.php",
data: data ,
cache: false,
success: function() {
window.location.reload();
}
});
}