I have an input button
<input type="button" class="ariPartListAddToCart ariImageOverride" id="ariparts_btnCart0" onclick="ARI.PartStream.Cart.PostSkuQty(this.id, 'POST', 'PartsDetail', '', '')" value="Add To Cart" name="c.myshopify.com/cart?arisku=dd-HR0-F01AH&ariqty={aripartqty}&ariprice=138.17&aribrand=HOM&arireturnurl={arireturnurl}" brand="HOM">
and I have this AJAX call:
$(document).ready(function() {
$('.ariPartListAddToCart').on('click', function() {
var $button = $(this);
var arisku = $button.data('arisku');
var ariqty = $button.data('ariqty');
var ariprice = $button.data('ariprice');
var aribrand = $button.data('aribrand');
var arireturnurl = $button.data('arireturnurl');
// Update the name attribute value
var updatedName = 'http://demowebsite.com/democart/cart.aspx';
$button.attr('data-name', updatedName); // Update the data-name attribute
// Construct data object
var dataObj = {
arisku: arisku,
ariqty: ariqty,
ariprice: ariprice,
aribrand: aribrand,
arireturnurl: arireturnurl,
name: updatedName
};
$.ajax({
type: 'POST',
url: '/cart/add.js',
data: dataObj,
dataType: 'json',
success: function() {
alert('This is success')
},
error: function() {
alert('Not Success')
}
});
});
});
The input button, is coming from a script that I call from our vendor server. I have used product-form.js to include the ajax above, however, whenever I click on Add To Cart button from that input button, it is still taking me to c.myshopify.com/cart instead of the url updatedName. Am I on the right track?