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 一个识别内容的自动化脚本程序
  • ¥15 anaconda虚拟python环境部署langchain-chatchat报错
  • ¥20 matlab有约束条件下的多元函数求最小值
  • ¥50 如何隐藏网页弹出框的url地址栏
  • ¥20 metropolis算法模拟二维ising模型来计算磁化强度,fortran
  • ¥15 uniapp-typescript-vue报错
  • ¥15 oracle强制关机以后报错01033
  • ¥15 给Chat with RTX添加语言模型时遇到问题
  • ¥15 oracle修复,怎么根据日志修复呀?
  • ¥15 使用Stable Diffusion时出现错误