Rails routes into application.js

There’s a way to use rails routes into a jquery function puts inside
the file application.js?
I want to do something like this:

$("#printed").click(function() {
$.get(“customer_path(@customer)”)

Well, it depends on whether it’s a link or form.

if a link, you would do:

$(“#printed”).click(function() {
$.get($(this).attr(“href”), null, null, “html”);
return false;
});

if a form,
(“#printed”).submit(function() {
$.get($(this).attr(“action”), null, $(this).serialize, “script”);
return false;
});

Jason L.

Email [email protected]

Mobile 410.428.0253

AIM canweriotnow
Facebook Redirecting...

On 5 February 2011 19:23, Jason L. [email protected] wrote:

Well, it depends on whether it’s a link or form.

It is just a button:

Print