Ajax submit

Hi,

Am able to ajax submit a form in rails view using submit_to_remote and
as expected my results are updated in div without refreshing whole page.
But if i use prototype library am not able to use jquery in that page,
so is it possible to submit a form without using prototype library?

Sharanya S. wrote:

Hi,

Am able to ajax submit a form in rails view using submit_to_remote and
as expected my results are updated in div without refreshing whole page.
But if i use prototype library am not able to use jquery in that page,
so is it possible to submit a form without using prototype library?

The best thing for you to do is to install the jrails plugin (or gem
maybe?) which replaces all of the built-in prototype helpers with jquery
equivalents. After doing that, when you say link_to_remote, all of the
additional javascript that rails puts in for you will use jquery instead
of prototype, and you can banish prototype completely. You don’t need
to make any changes to your code.

This post belongs in the Ruby on Rails section rather than the Ruby
section btw :slight_smile:

oh and as a side note, you can mix and match jquery and prototype, as
long as
a) you use the noconflict option with your jquery code (so $(whatever)
will always use prototype), and
b) you write out jQuery(whatever) instead of $(whatever) whenever you
want to use jquery.

However, it’s simpler to just banish prototype and switch to 100% jquery
as described above.

Max W. wrote:

oh and as a side note, you can mix and match jquery and prototype, as
long as
a) you use the noconflict option with your jquery code (so $(whatever)
will always use prototype), and
b) you write out jQuery(whatever) instead of $(whatever) whenever you
want to use jquery.

However, it’s simpler to just banish prototype and switch to 100% jquery
as described above.

Thankx a ton :slight_smile:

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