语法错误,当我尝试使用连字符 (-) 初始化键时
Syntax error, when I try initialize a key with hyphen (-)
以下对象初始化时,抛出错误。
var postData ={
file_path : "https://s3-us-west-2.amazonaws.com/ps/eams/6-48K.mxf",
template_type : "1",
template_name : "Basic Tests",
job_type : "0",
user_note : "my job",
access-key-ID : "AKAEBQ",
access-key-SECRET : "ZZHfO"
};
错误是
access-key-ID : "AKAEBQ",
^
SyntaxError: Unexpected token -
我该如何处理?
将键设置为字符串:
var postData ={
'file_path' : "https://s3-us-west-2.amazonaws.com/ps/eams/6-48K.mxf",
'template_type' : "1",
'template_name' : "Basic Tests",
'job_type' : "0",
'user_note' : "my job",
'access-key-ID' : "AKAEBQ",
'access-key-SECRET' : "ZZHfO"
};
以下对象初始化时,抛出错误。
var postData ={
file_path : "https://s3-us-west-2.amazonaws.com/ps/eams/6-48K.mxf",
template_type : "1",
template_name : "Basic Tests",
job_type : "0",
user_note : "my job",
access-key-ID : "AKAEBQ",
access-key-SECRET : "ZZHfO"
};
错误是
access-key-ID : "AKAEBQ",
^
SyntaxError: Unexpected token -
我该如何处理?
将键设置为字符串:
var postData ={
'file_path' : "https://s3-us-west-2.amazonaws.com/ps/eams/6-48K.mxf",
'template_type' : "1",
'template_name' : "Basic Tests",
'job_type' : "0",
'user_note' : "my job",
'access-key-ID' : "AKAEBQ",
'access-key-SECRET' : "ZZHfO"
};