Has anyone done anything like this with jquery?

15 views
Skip to first unread message

ebuyc

unread,
May 7, 2008, 1:56:50 PM5/7/08
to Jester JS
We are now using jQuery exclusively in our rails app.'s. I need to do
some Restful asynchronous calls. Not a big deal to do a GET or POST.
So does anyone know how to do a DELETE or PUT with a jQuery Ajax
call?
link_to_remote is broken with jrails, the :method => :delete does not
work in IE, yet a normal link_to with :method => :delete does.....
Anyone out there run into any of these issues?
I really like this Jester library, but we have decided not to load two
JS libraries (prototype and jQuery) so I can't use it.

$('div.pagination a').livequery('click', function() {
$('#TB_ajaxContent').load(this.href);
return false;
})

I really need to know how to form a $.post request (delete and put)
that rails will route properly asynchronously.

Any thoughts would be greatly appreciated.

Ebuyc

Eric Mill

unread,
May 10, 2008, 1:24:34 AM5/10/08
to jest...@googlegroups.com
Neither Prototype and Rails use actual PUT and DELETE requests. They
agree to fake it by POSTing with a parameter named "_method" set to
"put" or "delete". So, try manually adding "_method" as a key and
"put" as a value in your AJAX POST to Rails, and it should work.

Porting Jester to JQuery would be the best. I've tried to avoid using
Prototype's helper functions (like Array#each), but there are some in
Jester anyway, so those would have to be refactored to plain JS first.
Then, I think just Jester's request and requestAndParse would have to
be rewritten. Jester's specified API for AJAX options is to use
Prototype's, so some translation from Prototype arguments to JQuery
arguments would be required as well. Anyone else interested in seeing
this?

-- Eric

Danny LaBare

unread,
May 20, 2008, 2:44:36 PM5/20/08
to Jester JS
I for one am very much interested in a jQuery friendly Jester. I work
on a project that has recently abandoned prototype in favor of jQuery,
and will be keeping my eye on this group for updates. :) Awesome
stuff by the way.

On May 9, 10:24 pm, "Eric Mill" <kproject...@gmail.com> wrote:
> Neither Prototype and Rails use actual PUT and DELETE requests. They
> agree to fake it by POSTing with a parameter named "_method" set to
> "put" or "delete". So, try manually adding "_method" as a key and
> "put" as a value in your AJAX POST to Rails, and it should work.
>
> Porting Jester to JQuery would be the best. I've tried to avoid using
> Prototype's helper functions (like Array#each), but there are some in
> Jester anyway, so those would have to be refactored to plain JS first.
> Then, I think just Jester's request and requestAndParse would have to
> be rewritten. Jester's specified API for AJAX options is to use
> Prototype's, so some translation from Prototype arguments to JQuery
> arguments would be required as well. Anyone else interested in seeing
> this?
>
> -- Eric
>
Reply all
Reply to author
Forward
0 new messages