Skip to content

Commit 9268a98

Browse files
committed
Fixing issue with button editing
1 parent f6e722c commit 9268a98

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

index.html

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -389,30 +389,32 @@ <h3>Find out more</h3>
389389
input = $(inputs[i]);
390390

391391
if (input.val()) {
392-
data[input.attr('name')] = input.val();
392+
data[input.attr('name')] = {
393+
value: input.val()
394+
};
393395
}
394396
}
395397

396398
// Create a script tag to use as the HTML
397399
el = document.createElement('script');
398400

399-
if (data.button === 'cart') {
400-
el.src = 'paypal-button-minicart.js?merchant=' + data.business;
401+
if (data.button.value === 'cart') {
402+
el.src = 'paypal-button-minicart.js?merchant=' + data.business.value;
401403
} else {
402-
el.src = 'paypal-button.js?merchant=' + data.business;
404+
el.src = 'paypal-button.js?merchant=' + data.business.value;
403405
}
404406

405407
for (key in data) {
406408
if (key !== 'business') {
407-
el.setAttribute('data-' + key, data[key]);
409+
el.setAttribute('data-' + key, data[key].value);
408410
}
409411
}
410412

411413
code.text(el.outerHTML.replace(/data-/g, "\n data-").replace("></" + "script>", "\n></" + "script>"));
412414

413415
// Update the button
414416
tryit.empty();
415-
PAYPAL.apps.ButtonFactory.create(data, data.button, tryit[0]);
417+
PAYPAL.apps.ButtonFactory.create(data.business.value, data, data.button, tryit[0]);
416418
});
417419

418420
</script>

0 commit comments

Comments
 (0)