I created an AJAX request. In the new browsers it works fine, but IE7 tells me there is an error with characters in the line, where function: 'gettestvaraibles'
stands. Can someone tell me where the error could be?
$.ajax('http://testurl/?eID=testid', {
data: {
function: 'gettestvaraibles',
game_id: '630',
game_score: '50'
},
type: 'post',
dataType: 'json',
error: function(jqXHR, textStatus, errorThrown) {
console.log(jqXHR);
alert(errorThrown.message);
},
success: function() {
}
});
Function is a reserved keyword. You need to either change it, or wrap it in quotes:
data: {
"function": 'gettestvaraibles',
"game_id": '630',
"game_score": '50'
},
You should put quotes around function
, because it's a keyword in JavaScript:
data: {
'function': 'gettestvaraibles',
'game_id': '630',
'game_score': '50'
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With