我尝试使用 Ajax 做一个 twitter 引导类型头,但没有发生任何错误。没有错误没有输出这是我的 jquery ajax 代码
function CallData() {
$('input.typeahead.local.remote').typeahead({
source: function (typeahead,query) {
$.ajax({
type: "GET",
url: "http://cs-api-sandbox.herokuapp.com/v1/challenges/search?keyword=r&callback=my_callback",
jsonpCallback: "my_callback",
dataType: "jsonp",
error: function (xhr, errorType, exception) {
var errorMessage = exception || xhr.statusText;
alert("Excep:: " + exception + "Status:: " + xhr.statusText);
}
});
}
});
}
function my_callback(data) {
alert('hi');
}
这是我的html代码
<input type="text" id="txt" runat="server" class="span4 typeahead local remote" placeholder="Search..." />
我CallData()
在每次按键时调用 ajax 函数,但没有任何反应