-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
  • 22,386
  • 64
  • 200
  • 328

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
  • 60,707
  • 10
  • 101
  • 129