Request fot coupon not working
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Request fot coupon not working
Hi Aimeos-Team,
if I request a coupon code in the basket, the called url in the xhr-Request is http://maydomain/undefined
The code in basket-standard.js makes no sense for me: what is product.data("url")?
If I changed to "ev.currentTarget.form.action" the form works...
Thank you!
if I request a coupon code in the basket, the called url in the xhr-Request is http://maydomain/undefined
The code in basket-standard.js makes no sense for me: what is product.data("url")?
Code: Select all
onSubmit() {
$(document).on("submit", ".basket-standard form", ev => {
Aimeos.createSpinner();
fetch(product.data("url"), {
body: new FormData(ev.currentTarget),
method: 'POST'
}).then(response => {
return response.text();
}).then(data => {
$(".basket-standard").html(AimeosBasket.updateBasket(data).html());
}).finally(() => {
Aimeos.removeSpinner();
});
return false;
});
},
Thank you!
Re: Request fot coupon not working
You mean this line?
Using "ev.currentTarget.form.action" seems to be wrong too but "ev.currentTarget.form" may be correct.
Code: Select all
body: new FormData(ev.currentTarget),
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,
![Image](https://aimeos.org/fileadmin/aimeos.org/icons/star.png)
Re: Request fot coupon not working
No, I mean
there is no "product" object present.
So if i change to
the request works.
Code: Select all
fetch(product.data("url"), {
So if i change to
Code: Select all
fetch(ev.currentTarget.form.action, {
Re: Request fot coupon not working
You are right, that doesn't make any sense but your suggested code doesn't work either in all situations. Instead, we are now using this line, which seem to work perfectly:
The updated code is available in aimeos/ai-client-html:2022.10.x-dev. Can you check if it now works for you too?
Code: Select all
fetch($(ev.currentTarget).attr("action"), {
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,
![Image](https://aimeos.org/fileadmin/aimeos.org/icons/star.png)