Hello,
I don't know who to contact, so I post this here in the hope some staff members from WebMoney read it. Or otherwise please forward it to them.
I would like to integrate the WebMoney JavaScript in my website to process payments.
This code works perfectly:
<script src="//merchant.webmoney.ru/conf/lib/wm-simple-x20.min.js?wmid=238833417836&purse=E305159194817&key=906724123&amount=10.00&desc=Product+Name&lang=en" id="wm-script"></script>
However, when you have a large AJAX website, you want to add the payment widget later AFTER the page is loaded and only when the user tries to make a payment. Basically like this:
<div id="webmoneyPayment"></div> <script type="text/javascript"> setTimeout(function () { var wmscript = document.createElement('script'); wmscript.setAttribute("type", "text/javascript"); wmscript.setAttribute("src", "//merchant.webmoney.ru/conf/lib/wm-simple-x20.min.js?wmid=238833417836&purse=E305159194817&key=906724123&amount=10.00&desc=Product+Name&lang=en"); wmscript.setAttribute("id", "wm-script"); document.getElementById("webmoneyPayment").appendChild(wmscript); }, 1000); </script>
However, the second code doesn't show the payment widget, even though the webmoney script gets loaded. My guess is, that the script waits for some events which only occur on the first page load (it's not just document.ready, I tried calling $.ready() .
Could you please fix your script, so that the second code works too? Would be great for all AJAX websites.
Thanks