<?php echo $asset_tag_helper->javascript_include_tag('prototype') ?>
<div id="time_div"> I don't have the time, but <%= link_to_remote( "click here", :update => "time_div", :url =>{ :action => :say_when }) %> and I will look it up. <br /> </div>
function say_when(){ $this->renderText("<p>テスト The time is <b>" . date('Y/m/d H:i:s') . "</b></p>"); }
<%= form_remote_tag(:update => "my_list", :url => { :action => :add_item }, :position => "top" ) %> New item text: <%= text_field_tag :newitem %> <%= submit_tag "Add item with Ajax" %> <%= end_form_tag %>
function add_item(){ $this->renderText("<li>" . $this->params['newitem'] . "</li>"); }
<%= text_field_tag :searchtext %> <%= observe_field(:searchtext, :frequency => 0.25, :update => :search_hits, :url => { :action => :live_search }) %> <p>Search Results:</p> <div id="search_hits"></div>
<select id="options" onchange="<?=$prototype_helper->remote_function(array('update' => 'options', 'url' => array('action' => 'update_options') )); ?>"> <option value="0">Hello</option> <option value="1">World</option> </select>
function update_options(){ $data = array("ああ"=>"いい","うう"=>"ええ"); $result=""; foreach($data as $key=>$val){ $result .= "<option value=\"{$key}\">{$val}</option>"; } $this->renderText($result); }
コメントはありません。 Comments/Memo/Akelos/sample/ajax