Could anybody help with this?
I am trying to integrate a coupon function into the order process on my website using jQuery to post the coupon code used and check the coupon code used exists in my database. However jQuery post will not work correctly. Here is my code.
jQuery(function () {
jQuery("#discount-code").click(function () {
var coupon = jQuery("#CouponCode").val();
if (coupon) {
alert("Coupon Used");
jQuery.ajax({
success: function (data) {
if (data) {
alert("DATA RECEIVED");
}
},
data: 'coupon=' + coupon,
type: 'POST',
dataType: 'json',
url: 'http://example.com/process-coupon.php'
});
}
return false;
});
});
I am getting the coupon used alert but after that nothing. I am not even seeing the post info in firebug.
Can anybody see the problem here?
The problem you describe usually (not even a POST visible in Firebug) comes down to one simple problem named Same origin policy. But this is nothing but a guess (though a very good one) until you post your HTML.