0

I need open new tab using Pay now If am click paynow button that links open new tab.

$(function() {
  $("#OrderTable > tbody > tr > td> .paynow").click('click', function(Myevent) {


    Myevent.preventDefault();
    var urls = $(this).attr('href');
    var passval = $(this).parents().siblings('td:eq(1)').text();

    $.ajax({
      type: "POST",
      datatype: "json",
      async: true,
      url: '/MyAccount/PayNow?OrderId=' + passval,
      contentType: "application/json; charset=utf-8",
      success: function(RtObject) {
        //alert(RtObject.isError);
        //alert(RtObject.CId);
        if (!RtObject.isError) {
          //alert(RtObject.isError);
          if (RtObject.CId == 1) {
            var newwin;
            if (newwin && !newwin.closed) {
              newwin.focus();

            } else {
              window.location.href = RtObject.ReturnVal;




            }
          } else if (RtObject.CId == -1) {
            jAlert(RtObject.Message, "Failure");
          }
        }
      },
      failure: function(response) {
        jAlert("Cant go to payment process", "Failure");
      }
    });

  });

I need open new tab .please solve this.

tereško
  • 58,060
  • 25
  • 98
  • 150
White
  • 31
  • 1
  • 7
  • 2
    http://stackoverflow.com/questions/19851782/how-to-open-a-url-in-a-new-tab-using-javascript-or-jquery#answer-23442790 – BenG Mar 29 '16 at 11:56
  • BenG, I got the results from window.location.href = RtObject.ReturnVal; but now am click pay now button , its open new tab. – White Mar 29 '16 at 12:01
  • window.location.href = RtObject.ReturnVal; $(this).target = "_blank"; this is not working for me. – White Mar 29 '16 at 12:21
  • Possible duplicate of [Open a URL in a new tab (and not a new window) using JavaScript](http://stackoverflow.com/questions/4907843/open-a-url-in-a-new-tab-and-not-a-new-window-using-javascript) – dingo_d Mar 29 '16 at 13:10
  • I tested lot of examples please specify correct answers. – White Mar 29 '16 at 13:25

0 Answers0