两者的代码相同Web server
,local server
但使用 firebug 我得到两种响应链接:
工作正常
GET http://localhost/www.test.co.uk/index.php/home_Controller/getSearch/r
“网络错误:404 未找到
GET http://www.test.co.uk/index.php/home_Controller/getSearch/r"
这是我的 JS:
$(document).ready(function(){
$('#performsearch').keyup(function(e){
//if key is enter stop search
if(e.which == 13)
{
e.preventDefault();
}
var searched = $('#performsearch').val()
var fullurl = $('#hiddenurl').val() + 'index.php/home_Controller/getSearch/' + searched
$.getJSON(fullurl,function(result){
var elements = [];
$.each(result,function(i,val){
elements.push(val.title)
})
$('#performsearch').autocomplete({
source : elements
})
})
})
})