2014-09-12 48 views
-1

我试图做到这一点,但它不工作如何在新窗口中打开结帐? simplecartjs 3.0.5

<i> extendCheckout: function (methods) { 
    return simpleCart.extend(simpleCart.checkout, methods); 
      }, 
      generateAndSendForm: function (opts) { 
       var form = simpleCart.$create("form"); 
       form.attr('style', 'display:none;'); 
       form.attr('action', opts.action); 
       form.attr('method', opts.method); 



       simpleCart.each(opts.data, function (val, x, name) { 
        form.append(
         simpleCart.$create("input").attr("type","hidden").attr("name",name).val(val) 
        ); 
       }); 

       simpleCart.$("body").append(form); 

       form.el.submit(); 
       form.remove(); 

      } 
     }); 

     simpleCart.extendCheckout({ 
      PayPal: function (opts) { 
       // account email is required 
       if (!opts.email) { 
        return simpleCart.error("No email provided for PayPal checkout"); 
       } 

       // build basic form options 
       var data = { 
          cmd   : "_cart" 
         , upload  : "1" 
         , currency_code : simpleCart.currency().code 
         , business  : opts.email 
         , rm   : opts.method === "GET" ? "0" : "2" 
         , tax_cart  : (simpleCart.tax()*1).toFixed(2) 
         , handling_cart : (simpleCart.shipping()*1).toFixed(2) 
         , charset  : "utf-8" 



        }, 
       action = opts.sandbox ? "https://www.sandbox.paypal.com/cgi-bin/webscr" : "https://www.paypal.com/cgi-bin/webscr", method = opts.method === "GET" ? "GET" : "POST" ; </i> 

我使用form.target = "_blank"; target = "_blank"但没有努力,

演示: https://e70f9b946472493e61425bd76235c6dfd3f4593d.googledrive.com/host/0B87ueB-BviwSUDgydXRxWi16OGM/#/

谁能帮助请!

回答

1

尝试

form.attr('target', '_blank');