hacktyler/hacktyler-artmap — pull request #44 by joequery (2012-03-30 16:05:58+00:00)
Title: Added query utility function

I believe the query utility will help facilitate development, because that jQuery ajax callback is a huge sucker.

I gave examples of how to use it in the function declaration, but I'll talk about it a bit here since it might look weird at first.

Here's an example of a call

``` JavaScript
ART.utils.query(this, "SELECT * FROM %t", function($this, data){
$this.artwork_collection.reset(data);
});
```

Preserving the context of **this** in a real pain in the ass when it comes to callbacks, so the easiest thing to do was just require that you pass in **this**. You'll also see **$this** in the callback function, which is actually equal to **this**, so you can treat it the same way.

Wherever you see '%t', the query utility substitutes the that long fusion table name.

It looks a little clumsy and the **this** vs **$this** is less than ideal, but I think the benefits of having a simple query wrapper outweigh the annoyances.