I have this line of code in my method in a backbone router.
$.when(system.sideEngine.fetch(), system.lifeSupport.fetch()).done( ...
It works fine if the system has a sideEngineId
and a lifeSupportId
. However if either id is missing, I get a 404 not found error, and my page won't load.
I tried including an error statement like this:
error: function (model, xhr, options) {
console.log("something went wrong!");
}
But that's not what I'm looking for. I don't want the absence of ids to be a show stopper. I still want the system to load regardless.
Is there a way to conditionally check for an id before I do a fetch other than creating a complicated if/then tree?