weixin_33738578 2015-08-18 03:35 采纳率: 0%
浏览 23

无法获取网址参数

I have used ajax url with one parameter month which i selected from option box

  $.ajax({
    url: baseUri + 'attendancelist/search/attsearch/month/' + month ,
    type: 'GET'
    ...
        });

So i want to call that parameter in my attsearchAction() So i code like this

public function attsearchAction() {        
    $month = $this->request->get('month');  //current testing framework is phalcon
    //$month = $this->_request->getParam('month'); //zend framework is ok by getParam
    var_dump($month);exit;     //null
   }

But it only show null? How to fix that>>

  • 写回答

2条回答 默认 最新

  • weixin_33720956 2015-08-18 03:40
    关注

    If you want to pass parameter with url than you should use ? to pass parameter

    url: baseUri + 'attendancelist/search/attsearch/?month=' + month
    

    Alternately, as you are using ajax, so you can send the data using ajax.

    $.ajax({
        url: baseUri + 'attendancelist/search/attsearch/',
        type: 'GET',
        data: {month: month},
        ...
    });
    
    评论

报告相同问题?

悬赏问题

  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥15 一道python难题3
  • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试