We have all asked for something in the name of Jesus that we did not receive--something important and precious to us, perhaps something for which we were desperate.
But Jesus said, "Anyone who has faith in me will do what I have been doing.... Whatever you ask in My name, that will I do.... If you ask Me anything in My name, I will do it" (John 14:12-14). Notice that for emphasis, Jesus stated his promise twice to "do" for the glory of the Father "whatever" and "anything" that we ask "in My name."
What, then, do we make of our experience with unanswered prayer? Do we need to make an excuse for Jesus? Do we need to "hedge" on the veracity of Scripture? Not really. Our task is to explain Scripture, not explain it away. So let's do that.
First, what does it mean to ask "in My name?" This is not a magical, binding incantation. This is not about saying the right words in the right order. It's not a top secret password that we need to get in. We are already insiders. Rather, to ask "in the name" of another means to ask as their representative or envoy, like the Secretary of State goes in the name of the President. Or, for dramatic effect, like Tom asked for "favors" in the name of Don Corleone in The Godfather. A representative, then, doesn't ask for what he wants to do, but for what whomever sent him wants to do, like the congressman sent to Washington "in the name of" his or her constituents. So to ask "in My name" means to ask the Father on behalf of Jesus to do "whatever" or "anything" Jesus would have asked him to do. Simply, the will of God.
Second, what is this "whatever" or "anything" for which we can ask? What is this will of God? Jesus said, "Anyone who has faith in me will do what I have been doing" (14:12). What was Jesus doing? We really need to get this right because that's what he will "do" when we ask "in his name." Jesus was inaugurating the kingdom of God on earth in a way that could forcefully advance. His central strategy was to make disciples who would make other disciples. And as he was making disciples, he also met the immediate needs of people. So he was operating on two levels – presenting problems and root problems, treating symptoms and underlying diseases, addressing the immediate crisis and the long-term. It was (and is) a both/and situation. In fact, the essential definition of discipleship means to meet people's temporal as well as spiritual needs – even though the spiritual ultimately dwarfs the temporal.
So when we pray and ask "in the name of Jesus" for "anything" or "whatever" because we want to do what he is doing, we can be 100% certain that he will "do it." While far from the only kind of prayers God will answer, these he will most definitely answer.