我的功能自動完成是:jQuery的自動完成的serviceURL改變
$(document).ready(function(){
var a = $('#issued_to').autocomplete(
{
serviceUrl: 'http://myhost.com/ecard_emp_suggestion/',
minChars: 1,
delimiter: /(,|;)\s*/, // regex or character
maxHeight: 400,
width: 300,
zIndex: 9999,
deferRequestBy: 0, //miliseconds
//params: { country:'Yes' }, //aditional parameters
noCache: false, //default is false, set to true to disable caching
// callback function:
onSelect: function(value, data){ alert('You selected: ' + value + ', ' + data); },
// local autosugest options:
//lookup: ['January', 'February', 'March', 'April', 'May'] //local lookup values
});
});
現在的問題是,它發送請求: http://myhost.com/ecard_emp_suggestion?query=input_text
,但我需要http://myhost.com/ecard_emp_suggestion/input_text
我應該在哪裏換什麼& ??
我就這樣在最後一行添加encodeURIComponent方法()周圍將q變量: $獲得(this.serviceUrl + '/' + encodeURIComponent方法(Q),// ..該行的其餘部分 – complex857 2012-07-15 14:21:38