Then he says that the sign of this undoubted faith is none other than the boldness which we find before Him through blameless faith, as we also said above, and that in turn the sign of such boldness is the obtaining of everything we ask. But since not all receive everything they ask, and not all requests are heard, he adds: "according to His will," that is, whoever asks for something contrary to the will of the Teacher will not be heard either. In this case he speaks similarly to holy James: "you ask, and do not receive," he says, "because you ask amiss" (James 4:3). Turning this sign into a m...ost clear indication, he says: and if we know that He hears us in everything, whatever we may ask, then we also know that we receive from Him everything we ask of Him. He speaks as if to say: if we ask of God what is in accordance with His will, then He hears us; and if He hears us in our requests, then we know that we bring requests in agreement with His will, and what we ask we already have in ourselves. Such things are the Kingdom of God and His righteousness, which He Himself also commanded us to seek in the Gospel (Matt. 6:33).
Source: Commentary on 1 John