I have an AJAX code that's working on all browser the way it's supposed to but not working on iOS safari. On iOS safari it doesn't call the success: function and goes directly to error: function. Why is this happening.
On further exploring the data: cartData on iOS safari comes out to be
quantity=1&id=<a href="tel:33217807108">33217807108</a>
instead of just quantity=1&id=33217807108
.
Here is the code:
$.ajax({
type: 'POST',
url: '/cart/add.js',
data: cartData,
dataType: 'json',
cache: false,
headers: { "cache-control": "no-cache" },
success: function(cartData){
if(product == 1){
if(cartCounter == (noItems - 1)){
// console.log('update');
updateCart();
}else{
// console.log('add to cart');
cartCounter++;
cartAdd(productType,1);
}
}else{
// console.log('update 2')
updateCart();
}
},
error: function(response){
alert(response);
}
});
}