Skip to content

@patridge /AjaxParallelController.cs
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
namespace YourNamespace.Controllers {
using System.Web.Mvc;
using System.Web.SessionState;
using System;
[SessionState(SessionStateBehavior.ReadOnly)]
public class AjaxParallelController : Controller {
public JsonResult GetWait(int i = -1) {
System.Threading.Thread.Sleep(5000);
return Json(new { id = i, type = "parallel", ts = DateTime.Now.Ticks }, JsonRequestBehavior.AllowGet);
}
}
public class AjaxSerialController : Controller {
public JsonResult GetWait(int i = -1) {
System.Threading.Thread.Sleep(5000);
return Json(new { id = i, type = "serial", ts = DateTime.Now.Ticks }, JsonRequestBehavior.AllowGet);
}
}
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script>
$(function() {
var log = function (data) {
console.log(data.type + "[" + data.i + "]: " + data.ts);
};
for (i = 1; i <= 3; i++) {
$.ajax("/AjaxParallel/GetWait/?i=" + i, {
ifModified: false,
cache: false
}).done(function(data) {
log(data);
});
}
for (i = 1; i <= 3; i++) {
$.ajax("/AjaxSerial/GetWait/?i=" + i, {
ifModified: false,
cache: false
}).done(function(data) {
log(data);
});
}
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.