Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Here I have a button that posts an item \"nike shoes\" to my shopping cart, and

ID: 3725259 • Letter: H

Question

Here I have a button that posts an item "nike shoes" to my shopping cart, and below is a javascript function. I want to be able to post the item to the shopping cart when a user swipes right rather than them having to click the button. Please see code below:

Add to cart button:

<form target="paypal" action="https://www.paypal.com" method="post">
<input type="hidden" name="" value="_s-xclick">
<input type="hidden" name="" value="1234">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

JavaScript Function

var cards =[

new Tindercardsjs.card(0, 'Nike', 'shoes, $55', 'nike.jpg'),

];

Tindercardsjs.render(cards, $('#main'), function (event) {

if(event.direction === 'right' && event.cardid==0){

I want the item "nike shoes" to be posted to my checkout when user swipes right on the item

}

Explanation / Answer

Hi... Please test below.

var cards =[

new Tindercardsjs.card(0, 'Nike', 'shoes, $55', 'nike.jpg'),

];

Tindercardsjs.render(cards, $('#main'), function (event) {

if(event.direction === 'right' && event.cardid==0){
var url = "http://www.nike.com/"+event.card;
window.location.href(url);
}

Please check and let me know any querries. Thank you. All the best.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote