我在 document.ready 中有下面的代码,当我使用 Chrome 的调试器查看为什么没有发生任何事情时,我发现由于某种原因,ajax 调用被跳过了?
var latitude = $('#LatitudeHidden').val();
var longitude = $('#LongitudeHidden').val();
var from = $('#<%:FromTextBox.ClientID %>').val();
var to = $('#<%:ToTextBox.ClientID %>').val();
var type = $('#<%:TypeEnhancedDropDownList.ClientID %>').val();
var specialLocation = $('#<%:SpecialLocationsEnhancedDropDownList.ClientID %>').val();
var json = {
'latitude': latitude,
'longitude': longitude,
'from': from,
'to': to,
'type': type,
'specialLocation': specialLocation
};
$.ajax({
type: "POST",
url: "List.aspx/GetFilteredLocations",
data: json,
contentType: "application/json; charset=utf-8",
dataType: "json",
error: function(msg)
{
console.log(msg);
},
success: function(msg)
{
console.log(msg.d);
}
});