English 中文(简体)
CakePHP 2.0 活 动
原标题:CakePHP 2.0 Livesearch

I m trying to create this: http://www.justkez.com/cakephp-livesearch/ in CakePHP 2.0. The problem is that the AjaxHelper is not available anymore in CakePHP 2.0, and so

echo $this->Ajax->observeField( query , $options);

不再工作。

任何建议?

最佳回答

我最后采用上文所建议的“共同幸福”方案。 我将将此记为答案,因为它载有关于如何做到这一点的实际守则实例。

<h3>Search Reservations</h3>
<?php
echo $this->Html->css( screen );
// we need some javascripts for this
echo $this->Html->script( jquery );
// create the form
echo $this->Form->create(false, array( type  =>  get ,  default  => false));
echo $this->Form->input( query , array( type  =>  text , id  =>  query ,  name  =>  query ,  label  => false))?>
<div id="loading" style="display: none; ">
<?php
echo $this->Html->image( ajax_clock.gif );
?>
</div>
<?php
$this->Js->get( #query )->event( keyup , $this->Js->request( 
array( controller  =>  sales , action  =>  searchReservations , $event[ Event ][ id ]), 
array( 
 update  =>  #view , 
 async  => true,
 dataExpression  => true, 
 method  =>  post , 
 data  => $this->Js->serializeForm(array( isForm  => false,  inline  => true))) 
));
?>
问题回答

<代码>AjaxHelper的电话是 Java本功能的公正方便方法,其中大多数可以在 Java本体内轻易实现,而这正是我喜欢做的。 我假定观察现场只会增加“交流”活动听众,但我从未使用过,因此我可以肯定。

在Cake 2.0(和1.3)中,AjaxHelper被替换,但名称为JsHelper,它利用各种发动机适应现有的多种 Java本框架。 也许没有AjaxHelper所用的同样方法,但它具有更大的灵活性,而且我确信这符合你们的需要。





相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

How can i update div continuously

I have asp.net application where i have a div which showing the value from other site. The value of that site is changing continuously. I want that my div will automatically update in some interval ...

热门标签