只是想知道在我开始破解我的代码之前。例如:
if (blahblah) {
$.ajax("randomthingy1");
}
if (blahblahblah) {
$.ajax("randomthingy2");
}
// Use jQuery to test when they've both finished. Obviously they won't always both finish, as they might not both exist, and none of them might exist either.
$.when($.ajax("randomthingy1"), $.ajax("randomthingy2"), function (stuff) {
// foo
}
// Might produce an error, as one might not exist. But will it move on and not bother?
就是想。如果它确实会产生错误并停止执行,有没有办法捕捉错误并继续?