jQuery post requests with a json response, sans eval()

Tuesday, May 18. 2010
Comments

I know some of you out there are probably tired of jQuery and people raving about it's goodness, but bare with me! Because jQuery never ceases to amaze me — especially when I haven't looked at it — or client-side JavaScript code in general — in a good year or so.

Refactoring

I've been refactoring some of my old JavaScript libs on a project and I noticed that I had used evil eval() all over the place to parse the JSON from our API. Guess we all know that this is not just a security issue since it allows code execution, but also a performance hit. And here's how to get around it. :-)

A codesnippet to automatically parse a JSON response from a $.post-request:

$.post(
  '/the-url-post-to',
  data,
  function(json) {
    // handle response
  },
  'json'
);

Note: The 4th parameter 'json' in $.post(). Magic.

Fin

That's all.

Defined tags for this entry: , , ,

JSConf.eu 2009: My takeaway

Thursday, December 10. 2009
Comments

Sorry, I'm late for a post-conference praise — but anyway!

JSConf(.eu) was one awesome conference. But you may ask why?

So for starters, and full-disclosure, I know a couple of the people who were involved organizing the conference, but that's not all.

Here is what they did to make it an awesome conference

The organizer managed to cram a ton of interesting sessions into only two days. For those sessions they invited very interesting speakers and also managed to attract not less interesting attendees. Season those two days with three awesome parties (pre-conf, conf, post-conf (and one insane post-post-conf)), and you will only begin to imagine what you missed out on. In any case, go check out twitter, the pictures and the slides!

Meet & greet!

Without further ado, here's a list of people I recommend not only following on Twitter, but also hanging out for realz (in alphabetical order):

@amyhoy, @binary42, @cramforce, @eamonleonard, @furf, @janl, @nonken, @paulca, @psvensson, @roidrage, @ryah, @sh1mmer, @thomasfuchs

(Hope I didn't forget anyone!)

Thanks, and I'll hopefully see everyone soon, or next year! :-)

Defined tags for this entry: , , ,