So, i'm trying to create a button
<div id="coinbasetest" class="coinbase-button" data-code="6ad16caf532b5d802a1141766ee4d823" data-button-style="none"></div><script src="https://www.coinbase.com/assets/button.js" type="text/javascript"></script>
(This is just a temporarily div), I replace the "data-code" attribute with another value through ajax and php script. The problem is, when i replace it, it doesn't work. It says it can't find the model.. and it CLEARLY matches up
See image for console log: https://i.stack.imgur.com/diCOs.png
Ajax:
success: function(response) {
var test = document.getElementById('coinbasetest');
test.setAttribute("data-code", response.buttonCode);
console.log(test);
$(document).trigger('coinbase_show_modal', response.buttonCode);
If I just replace the data-button with a "static" one, it seems to work but the data-code is not static because my checkout depends on what the other users decide to purchase!
Correct. What's happening is the modal is created when the page first loads, so switching out the
data-code
later on doesn't do anything useful.The way we recommend handling this is: