PHP:AJAX:获取:不正确的URL

时间:2016-04-20 23:38:47

标签: php jquery ajax apache

我正在将我的应用程序移到新服务器上,并且最近遇到了一些问题。 PHP version: 5.5.34,Mac OSX Apache 2.4

Laravel版本:4.2

我得到一个网格,但我的浏览器抱怨网址。

我的ajax请求如下:

$(grid_name).jqGrid({

    //to get this function working make sure you've .htaccess file  
    //url:'illumina_xhr_get_data', - won't work if not added illumina 
    url:"illumina/illumina_xhr_get_samples",
    //url:"illumina/illumina_xhr_get_samples",
    datatype: "json",
    mtype: "GET",
    jsonReader: {
        repeatitems: false,
        id: "",
        root:  function (obj) {
            return obj;
        },
        records: function (obj) {
            return obj.length;
        },
        page: function () {
            return 1;
        },
        total: function () {
            return 1;
        }
    },

    colNames:['Study','Sample Name','Forward Primer',
            'Reverse Primer','Region','Read Length','Seq Platform', "ID"], //id is hidden.. that is used while making group
    colModel :[ 
               {name:"study_name",sortable: true}, 
               {name: "sample_name",sortable: false},
               {name: "forward_primer",sortable: false},
               {name: "reverse_primer",sortable: false},
               {name:"region",sortable:false},
               {name:"read_length",sortable:false,align:'right'},
               {name:"seq_platform",sortable:false},
               {name:"id",sortable:false,hidden:true}

               ],
        rowNum:10, //this sets the default row in the pager
        caption:"Illumina", //title of the grid
        pager: pager_name,  
        shrinkToFit : false,
        rownumbers: true, //row numbers on left
        multiselect: true, //check box
        height: '400', //height: 'auto',
        width: '1100',
        gridview: true,         
        viewrecords:true, // this is for the View 1 - 8 of 8 \m/
        sortorder:"asc", //asc 
        autoencode: true, //don't know
        sortable:true, //sort
        loadonce: true, //loadonce is must
        rowList:[500,1000,1500], //drop down
        page: 1,
        rowNum: 100,
        ignoreCase: true, //make search as case insenstive -- YAY.. Party
        grouping:true, //this is for grouping
        groupingView : { groupField : ['study_name'], //grouping based on study column
            groupText : ['<b>{0} - {1} Sample(s)</b>'] //this will give count of samples present
             } ///grouping view ends
});

`

错误:

The requested URL /pims/public/illumina/illumina_xhr_get_samples was not found on this server.

我的本​​地主持人指向~/Sites

相同的代码适用于我的其他机器(我正在转换)。

我无法找到解决方法。请帮助。

1 个答案:

答案 0 :(得分:0)

我找到了解决方案:.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

我要启用重写模块才能被服务器读取。

我在/var/log/apache2/error_log

中发现错误

希望它有所帮助。谢谢。