美好的一天。我想问一下如何更改父页面的位置,并显示一个新选项卡。我试了但是父页面没有改变位置。任何人都可以帮助我。提前谢谢。
<form action="sell_pdf.php" method="POST" target="_blank" id="yourform">
<input type="text" name="text1" id="text1">
<input type="text" name="text2" id="text2">
<input type="submit" id="submit-btn" value="Submit" />
</form>
<script>
$(function() {
$('#yourform').submit(function(event) {
event.preventDefault();
if(parseFloat($('#text1').val().replace(/,/g, '')) > parseFloat($('#text2').val().replace(/,/g, ''))) {
$.post(
$(this).attr('action')
, $("form").attr('target', '_blank');
, $(this).serialize()
, function() {
window.location.href = 'car_reserve.php';
} );
} else {
alert('Actual price is less than selling price.');
}
} );
} );