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)")
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 Lewis
Email jasonlewis.x@gmail.com
Mobile 410.428.0253
AIM canweriotnow Facebook http://www.facebook.com/canweriotnow
It is just a button:
<button id="printed">Print</button>