Cookie Notice

As far as I know, and as far as I remember, nothing in this page does anything with Cookies.


Thank you, Stack Overflow!

I have to thank Stack Overflow again.

I code everything from SQL to Javascript, and that means that I don't really get to become expert in everything. I do alright, but there's occasionally things I just don't get, and I don't really have a community of developers around me to ask.

My most recent problem relates to hashes in Javascript connecting to JSON. You can make arrays behave like hashes in Javascript:

var hash = new Array()

hash['foo'] = 1

alert( )

My problem was with post, the jQuery method to do AJAX with large data sets. This didn't work.

$.post( url , hash , function() { ... } , 'json' )

Because hash is an abused array, not an object. Before I figured it out, today, thanks to SO, I make a long string that looked like { 'foo' : '1' , 'bar' : '2' } and ran eval on it. Bad bad bad bad bad. I now know that it should work like this:

var hash = {}

hash['foo'] = 1

$.post( url , hash , function() { ... } , 'json' )

Thanks again, StackOverflow!