Zend Framework 中以不同方式调用控制器 Action
我的控制器操作
public function abcsajaxAction(){
$start_date = $this->_getParam('start_date');
$end_date = $this->_getParam('end_date');
$myquery; //myquery
//zend pagination
}
我从这里调用这个操作我的意思是我的js
$("#show_history_call_logs").click(function(){
var pass = true;
var start_date = $("#start_date").val();
var end_date = $("#end_date").val();
var page_to_get = $('input[name=hidden]').val();
//some validation
if(pass == true){
var href= "http://localhost/abc/xyz/index.php/login/"+page_to_get+"/";
var data ='start_date=' + start_date + '&end_date=' + end_date + '&option_call_log=' + option_call_log + '&option_call_log_asc_desc=' + option_call_log_asc_desc;
$.ajax({ type: "GET",
url: href,
data: data,
success: function(response){
$('#paged-data-container').html(response);
}
});
return false;
}
现在在这个事件上我的意思是 $("#show_history_call_logs").click()
每次都工作正常 但正如我所说,此操作中也有分页,所以现在当我单击任何分页时,他们会转到此操作,但由于他们没有得到这些,
$start_date = $this->_getParam('start_date');
$end_date = $this->_getParam('end_date');
在这种情况下,它给了我这个
Message: SQLSTATE[HY093]: Invalid parameter number: no parameters were bound
错误另一方面,他们通过事件得到了我的意思。 那么我应该如何让它在两个场景中都起作用。
my Controller action
public function abcsajaxAction(){
$start_date = $this->_getParam('start_date');
$end_date = $this->_getParam('end_date');
$myquery; //myquery
//zend pagination
}
i call this action from here i mean my js
$("#show_history_call_logs").click(function(){
var pass = true;
var start_date = $("#start_date").val();
var end_date = $("#end_date").val();
var page_to_get = $('input[name=hidden]').val();
//some validation
if(pass == true){
var href= "http://localhost/abc/xyz/index.php/login/"+page_to_get+"/";
var data ='start_date=' + start_date + '&end_date=' + end_date + '&option_call_log=' + option_call_log + '&option_call_log_asc_desc=' + option_call_log_asc_desc;
$.ajax({ type: "GET",
url: href,
data: data,
success: function(response){
$('#paged-data-container').html(response);
}
});
return false;
}
now on this event i mean$("#show_history_call_logs").click()
its work fine every time
but as i said there is pagination too in this action so now when i click on any of pagination so they go to this action but as they are NOT getting These
$start_date = $this->_getParam('start_date');
$end_date = $this->_getParam('end_date');
in this case its giving me this error
Message: SQLSTATE[HY093]: Invalid parameter number: no parameters were bound
which in other side they are getting i mean through event.
so how should i go so that it work in both scene .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不明白你到底想实现什么目标。您的 sql 查询中有开始日期和结束日期。因此,您应该
例如以这种方式
I dont understand what exactly you want to achieve. You have start and end date in your sql query. So you should
For example in this manner
未测试,但尝试一下可能会有效
not tested but try may be it works