I am setting up some data to do an AJAX post and the code looks like this.
var data = {}
data.someId= 3;
data.anotherId = 4;
and this works fine. But why don't I need a semi-colon at the end of the first line?
Because JavaScript has Automatic Semicolon Insertion.
I erroneously called it Automatic Semicolon Injection earlier, which kind of makes sense :P
The language requires them, but it preprocesses your script and tries to guess where they should go. This doesn't always work out, as you can see in pst's comment.
You should just define the semi colons yourself. Don't let JavaScript guess.