我有一个ajax调用,它抓住了一个大的json列表.有没有什么方法可以创建一个进度条来获得json加载的实际值(例如,一个状态栏显示200个加载中的1个)?
现在我有一个非常基本的Ajax调用
function SendAjax(urlMethod, jsonData, returnFunction) {
$.ajax({
type: "GET",
contentType: "application/json; charset=utf-8",
url: urlMethod,
data: jsonData,
dataType: "json",
success: function (msg) {
if (msg != null) {
ReturnJson(msg);
}
},
error: function (xhr, status, error) {
// Boil the ASP.NET AJAX error down to JSON.
var err = eval("(" + xhr.responseText + ")");
// Display the specific error raised by the server
alert(err.Message);
}
});
}
Run Code Online (Sandbox Code Playgroud) 试图获取音乐会的名称,日期和地点(存储在另一张桌子上),但它似乎没有工作,但它不断拉回null.
var test = from f in db.Concert
where f.Name.StartsWith(concertName)
select new
{
f.Name,
f.StartDateTime,
venues = from v in db.Venues
where v.ID == f.VenueID
select v.Address
}
Run Code Online (Sandbox Code Playgroud)
编辑:
Venue和Concert之间的关系是Concert有一个与Venue ID相关的VenueID.我需要传回一个字符串.就像是
foreach (var e in test)
{
html += "<div> e.Name +":" + e.Address </div>;
}
Run Code Online (Sandbox Code Playgroud) 我有两个动作,每当我明确调用第二个动作时,第一个动作仍会被调用.我需要能够在mysite.com/api/Awesome/GetSomeExamples中编写,而不会总是触发GetAllClasses
public class AwesomeController : Controller
{
public IEnumerable<myClass> GetAllClasses()
{
//...some stuff
}
public IEnumerable<string> GetSomeExamples()
{
//...some stuff
}
//... also have some more actions which take in one parameter
}
Run Code Online (Sandbox Code Playgroud)
我的路由是这样的,但不起作用
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "ActionApi",
url: "api/{controller}/{action}/{id}",
defaults: new { id = UrlParameter.Optional }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
Run Code Online (Sandbox Code Playgroud)
我收到错误:找到了与请求匹配的多个操作