Project

maiha-mjs

0.0
No commit activity in last 3 years
No release in over 3 years
A slice for the Merb framework that offers Ajax actions like RJS with jQuery
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 1.0.7.1
 Project Readme
Mjs
===

A Ruby library that offers quite easy-to-use Ajax actions like RJS with jQuery.


Helper
======

  * link_to(name, url='', opts={})
  * button_to(name, url='', opts={})

  [opts]
    :remote  # Generate Ajaxed link if true, otherwise normal link.
    :submit  # Specifies the DOM ID that's used as the parent of
               the form elements. (should be symbol)
    :update  # Specifies the DOM ID that's replaced by the response.


Usage
=====

  link_to "GO", "/search"
    => '<a href="/search">GO</a>'

  link_to "GO", "/search", :remote=>true
    => '<a url="/search" onclick="; jQuery.ajax({dataType:'script', url:'/search'});; return false;" href="#">GO</a>'

  link_to "GO", "/search", :submit=>:foo
    => '<a onclick="; jQuery.ajax({data:jQuery('#foo input, #foo select, #foo textarea').serialize(), dataType:'script', type:'POST', url:'/search'});; return false;" href="#">GO</a>'


  link_to "GO", "/search", :update=>:bar
    => '<a url="/search" onclick="; jQuery.ajax({dataType:'html', success:function(request){jQuery('#bar').html(request)}, type:'POST', url:'/search'});; return false;" href="#">GO</a>'


Framework
=========

  * see 'README.Merb' for Merb users
  * see 'README.Monk' for Sinatra and Monk users


Copyright (c) 2008 maiha@wota.jp, released under the MIT license