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].invalid

Mobile 410.428.0253

AIM canweriotnow
Facebook http://www.facebook.com/canweriotnow

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs