2011-03-31 69 views
1
   $('body').append($('<form/>') 
      .attr({'action': 'https://www.paypal.com/cgi-bin/webscr', 'method': 'post', 'id', 'btn_submit'}) 
        .append($('<input/>')  
        .attr({'type': 'hidden', 'name': 'cmd', 'value': "_s-xclick"}) ) 
        .append($('<input/>')  
        .attr({'type': 'hidden', 'name': 'hosted_button_id', 'value': "SDFSDFFGHFGH"}) 
        ) 
        ).find('#btn_submit').submit(); 

我在此代码中有错误。我想知道我在哪里丢失代码。请帮助我。如何在使用jQuery传递POST数据时打开URL?

回答

1

它似乎是从.attr的电话。您正在使用一个逗号,而不是在最后一个冒号,将“ID”属性分配值“btn_submit”,所以它应该是:

{'action': 'https://www.paypal.com/cgi-bin/webscr', 'method': 'post', 'id': 'btn_submit'} 
+0

谢谢你这么多。你的权利。我能行 。 – linlin 2011-03-31 00:55:02

相关问题