Reputation: 3285
I have received the following error:
Uncaught SyntaxError: Unexpected token :
For this line:
data: userCoupon: $('#couponCode').val(),
Below is the script:
$(function() {
$("#signInButton2").click(function(){
$.ajax({
type:'POST',
url:'coursePayment.php',
data: userCoupon: $('#couponCode').val(),
success: function(data){
alert(data);
}
});
});
});
Upvotes: 0
Views: 95
Reputation: 10685
You're missing object brackets so your line should be
data: {userCoupon: $('#couponCode').val()},
In the script:
$(function() {
$("#signInButton2").click(function() {
$.ajax({
type: 'POST',
url: 'coursePayment.php',
data: {userCoupon: $('#couponCode').val()},
success: function(data) {
alert(data);
}
});
});
});
Upvotes: 2