ASP.Net的WebForms +贝宝表
问题描述:
我目前想的PayPal整合到我们现有的Web应用程序。
I am currently trying to integrate PayPal into our existing Web Application.
Web应用程序使用ASP.NET WebForms的。
The Web Application is using ASP.NET WebForms.
由于我们的WebForms周围有一个表单元素(几乎)的一切,我不知道如何整合它采用了形式本身就是一个PayPal按钮。
Since in WebForms we have a form element around (almost) everything, I wonder how to integrate a PayPal Button which uses a form itself.
有没有办法做到这一点?
Is there any way to do it?
答
是的。我做了三个步骤:
Yes. I do it in a three step process:
- 从贝宝code取出表单标签,因为你不能嵌套形式。
- 一个ID,类,或者说加入PayPal按钮,让你发现它在一个jQuery函数(本例使用
paypalbutton
的ID)。 - 添加jQuery脚本赶上点击覆盖窗体发布:
这可能需要修改与您的特定code的工作(但它可能工作原样):
This may need to be modified to work with your specific code (but it may work as is):
$(document).ready(function() {
$("#paypalbutton").on("click",function(n) {
n.preventDefault();
$("#aspnetForm").attr("action","https://www.paypal.com/cgi-bin/webscr");
$("#aspnetForm").submit(); //or whatever your WebForms form element is called
});
});