php - square pos card payment form integration in ajax -


i new square payment form integration. integrating form according documentation on https://docs.connect.squareup.com/articles/adding-payment-form .when embedding form on individual page works fine when loading form scripts in ajax showing error " referenceerror: sqpaymentform not defined ". 1 please suggest me way embed form in ajax.

the problem here trying run javascript on page (that has var paymentform = new sqpaymentform({... before external library has loaded.

if loading https://js.squareup.com/v2/paymentform asynchronously, you'll need delay execution of javascript on page until after external library has loaded. can via onload events, or waiting until page loaded (or lots of other ways, search "delaying javascript after async", easiest way load library synchronously.


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -