-2

When the following object is initialized, it throws an error.

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"
};

The error is

    access-key-ID : "AKAEBQ",
    ^
    SyntaxError: Unexpected token -

How could I handle this?

Suhail Gupta
  • 20,940
  • 62
  • 185
  • 313

1 Answers1

1

Set the keys as strings:

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"
};
Dekel
  • 57,326
  • 8
  • 92
  • 123