我试图将联系表单中的2个变量传递给Paypal。我有一个工作,但不是两个。我可以在控制台中看到正在收集2个变量,但是出现了问题。我正在使用联系表单7插件并将我的javascript放在那里。因此on_sent_ok
on_sent_ok: " my_name = jQuery('#fullname').val();"
on_sent_ok: " my_price = jQuery('#price').val();"
on_sent_ok: " console.log(my_name);"
on_sent_ok: " console.log(my_price);"
on_sent_ok: "location = 'https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=patrick%40thefitnessacademy%2eie&lc=IE&amount='+my_price%2e00¤cy_code=EUR&button_subtype=services&bn=PP%2dBuyNowBF%3abtn_buynowCC_LG%2egif%3aNonHosted&item_name=Personal Training Course for ' +my_name;"
答案 0 :(得分:1)
看起来您在'
之后缺少关闭单引号(+
)和连接运算符(...%2eie&lc=IE&amount='+my_price
),请尝试:
location = ' https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=patrick%40thefitnessacademy%2eie&lc=IE&amount=&#39 + my_price +'%2e00&安培; CURRENCY_CODE = EUR&安培; button_subtype =服务&安培; BN = PP%2dBuyNowBF%3abtn_buynowCC_LG%2egif%3aNonHosted&安培; ITEM_NAME =个人 培训课程为' + MY_NAME;