jQuery   发布时间:2022-04-19  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了jquery-ui – 如何使用Zend框架2实现jquery自动完成?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在寻找有关如何通过zend框架2实现 jquery自动完成的示例.

根据我之前使用java和coldfusion进行自动完成的经验,http响应必须只是@L_801_4@数据.但Zend通常会附加一个布局HTML(由模块配置定义).我正在虑使用一个空的布局文件(内容将是内容;?>)但我不确定这是否正确(即Zend方式)这样做.

我一直在网上搜索,但找不到任何有用的东西.

你能帮忙解决一些例子/链接/等等吗?谢谢

解决方法

要创建自动填充,您需要:

>创建一个控制器,以响应json通过get或post接收参数.

.

public function searchAction(){
// GET
$Params = $this->params ();
$count = $Params->fromQuery ( 'count',10 ); 
$offset = $Params->fromQuery ( 'offset',0 );
$search = $Params->fromQuery ( 'search',null );

// Mapper
$Search = TableMapper ();
$rs = $Search->search ( search,$count,$offset )); 

//I think good idea create an restful service if you have anothers requests

header('Content-Type: application/json');
echo \Zend\Json\Json::encode ( array (
        'status' => true,'data' => $rs,) );
die (); }

> jQuery / Angle收集字段中输入的字母.

$("#input").keyup(function(event) {
var stt = $(this).val();
/**
The search is route example,you need put correct url/route
**/
$.get( "/search",function( response ) {
    if(response.status == truE){
        $( ".result" ).html( response );
    }
});
});

> html显示响应

> JQUERY copy contents of a textbox to a field while typing
> JQuery UI Autocomplete with Zend Framework

大佬总结

以上是大佬教程为你收集整理的jquery-ui – 如何使用Zend框架2实现jquery自动完成?全部内容,希望文章能够帮你解决jquery-ui – 如何使用Zend框架2实现jquery自动完成?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。