Thanks again Simon - your help is very much appreciated!
Here are a few things I have found out - in case anybody else is
reading this:
* To get the authenticity tag to work you need this somewhere in your
view:
<%= javascript_tag "window._token = '#{form_authenticity_token}'" if
protect_against
Hey DAZ,
No probs.
From our code..
$.ajax({
url: "/form_datas/correct/"+formId,
so, form_datas is our controller, correct is the action, and formId is the
id param passed to the action
you may be able to use rails helper methods, I don't know, we just specify
the URL
Thanks again Simon, I've since noticed that all forms created by the
form_for helper have authenticity token code in too (albeit using some
ugly inline javascript!) so it id definitely something I'll look into.
On a separate note ... in your example, you simply listed
url: "url-to-your-rails-func
That's cool.
Depends on the query I think, but it is generally required.
Rails has some rudimentary security built in to stop things (like search
bots I guess) hitting controller functions. You can try it without, but
keep an eye on the logs for an invalid authenticity token error.
Simon
O
Thanks for this Simon - very useful. So it seems that $.ajax is just a
more general version of $.load and $.post - still trying to figure out
the exact differences, but at least now I can gain access to the
controller and start updating model attributes. I haven't had time to
test your code, but w
Thanks for this Simon - very useful. So it seems that $.ajax is just a
more general version of $.load and $.post - still trying to figure out
the exact differences, but at least now I can gain access to the
controller and start updating model attributes. I haven't had time to
test your code, but w
DAZ,
http://docs.jquery.com/Main_Page is pretty good.
We use $.post because of some extra stuff we need to do, but $.ajax is
probably the best option for you.
Something like this should work (warning, written in front of the TV and
untested)
$("#list").droppable({
accept: ".item",
ho
Thanks Simon, but I'm really new to jQuery - I think I know how to
call a function from the drop handler:
$("#dropper").droppable({
accept: "#dragger",
drop: dropped()
});
function dropped(){
// do stuff
}
But what do I have to put in the dropped function that actually
accesses rails? Yo
Hi,
You need to call a function in your drop handler that goes out to rails to
make the changes.
We do the following in some of our jquery handlers:
var c = {};
c['authenticity_token'] = encodeURIComponent(window._token);
c['user_id'] = <%= current_user.id %>;
$.post("<%= url_for(:action => '
9 matches
Mail list logo