更改位置和新选项卡JQuery

时间:2014-03-25 16:08:11

标签: jquery

美好的一天。我想问一下如何更改父页面的位置,并显示一个新选项卡。我试了但是父页面没有改变位置。任何人都可以帮助我。提前谢谢。

<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.');
    }
   } );
} );

0 个答案:

没有答案