jquery save method
<script type="text/javascript">
$(document).ready(function () {
$("#Button1").click(function () {
$.ajax({
type: 'POST',
contentType: "application/json;charset=utf-8",
url: 'Default2.aspx/InsertMethod',
data: "{'username':'" + document.getElementById('txtusername').value + "','password':'" + document.getElementById("txtpassword").value + "'}",
async: false,
success: function (response) {
$('#txtusername').val('');
$('#txtpassword').val('');
alert("record has been saved in database");
},
error: function () {
console.log('there is some error');
}
});
});
});