我的asp.net webforms项目中有以下脚本,我想重定向到一个新页面让我们在我的项目中说NewForm.aspx我该怎么做?我试过了window.location.href
,但它没有用。感谢您的帮助,谢谢!
<script type="text/javascript">
$(document).ready(function () {
$('#btnSubmit').click(function () {
$.ajax({
type: 'POST',
contentType: 'application/json; charset=utf-8',
url: 'DetailsForm.aspx/InsertMethod',
data: "{'firstname':'" + document.getElementById('firstName').value + "', 'lastname':'" + document.getElementById('lastName').value + "'}",
async: false,
success: function (response) {
$('#firstName').val('');
$('#lastName').val('');
alert("Record saved to database successfully!");
},
error: function ()
{ console.log('there is some error'); }
})
});
});
</script>