I have this code:
$('#my_form .submit').click( ->
$.ajax( ->
type: "post",
url: "????",
data: $("#myform").serialize(),
#success: this.saveUserResponse
)
POST /schedule_details(.:format) {:action=>"create", :controller=>"schedule_details"}
I guess this is 2 questions, or looking for the right way to do it. How can I use a shedule_details_create_path and how can I use that in my javascript? Or, is there a better way to do this?
Thank you for any help.
How about unobtrusively AJAXify the form instead of subscribing for the click handler of the submit button:
This way you can generate the form using the routing and have its action attribute properly set in the markup. Then your javascript is completely independent.