When attempting to save a JSON value as a variable from an AJAX response ...
$.ajax({
url:'example.php',
type:'POST',
dataType: 'json',
success:function(data){
var checkname = data.name; // works fine
var check1m = data.1m; // SyntaxError occurs here
}
});
... and the column name starts with a number (e.g. 1m):
[{"name":"Peter","city":"London","1m":"not attending","2m":"attending"}]
The error received is:
SyntaxError: identifier starts immediately after numeric literal
Is there a way to save the value in the variable (check1m)?