playframework/Play20 — pull request #717 by julienrf (2013-02-01 10:43:44+00:00)
Title: Remove jQuery. Adapt the JavaScript reverse router accordingly.

Similar to [pull request 170](https://github.com/playframework/Play20/pull/710). Here are the differences:
* By default no `ajax` method is generated for the JavaScript reverse router ;
* Users can ask to generate one (`Routes.javascriptRouter("Routes", ajaxMethod = true)(…)`), and it generates a self-contained, dependency-free, minimalist `ajax` method ;
* Users can provide their own JavaScript function for the `ajax` method. E.g. with jQuery: `Routes.javascriptRouter("Routes", ajaxMethod = "function (s) { s = s || {}; s.url = this.url; s.type = this.method; return $.ajax(s) }")` ;
* I also updated the documentation and fixed some bugs in it.

But, finally, I think it’s worthless to provide such an `ajax` method:
* That’s not modular: it forces to have a global function doing the Ajax call. Inverting the control (meaning writing our `ajax` function from the reverse router instead of writing the reverse router from the `ajax` function) would fix this issue ;
* Overloading makes the API difficult to reason about (my patch introduces overloaded variants of the `javascriptRouter` function).

So, maybe we should drop this `ajax` method support, or at least keep just one `javascriptRouter` function with the following definition:

```scala
def javascriptRouter(name: String = "Routes", ajaxMethod: Option[String] = None)(routes: JavascriptReverseRoute*): String
```

So we would drop the `javascriptRouter("Routes", ajaxMethod = true)(…)` overload, maybe we could replace it with something like: `javascriptRouter("Routes", ajaxMethod = StandaloneAjaxMethod)(…)`, where `StandaloneAjaxMethod` is an `Option[String]` value that contains a dependency-free Ajax function.

Thoughts?