Ajax请求包含无效字符

我创建了一个AJAX请求。 在新的浏览器中它工作正常,但IE7告诉我行中的字符有错误,其中function: 'gettestvaraibles'代表。 有人能告诉我错误可能在哪里吗?

 $.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() { } }); 

函数是保留关键字。 您需要更改它,或将其包装在引号中:

 data: { "function": 'gettestvaraibles', "game_id": '630', "game_score": '50' }, 

你应该在function周围加上引号,因为它是JavaScript中的关键字:

 data: { 'function': 'gettestvaraibles', 'game_id': '630', 'game_score': '50' }