In James 5, Elijah is mentioned. He was a man who saw a situation, prayed and obeyed God. His prayer was in the middle of doing what God is doing. The story of Elijah in James 5 is from the Old Testament of Elijah in 1 Kings chapter 17 and 18.
God is concerned that His people can experience definite answers to prayers if they will be as obedient as Elijah was. Elijah had frustrations, wonderings, doubts and feelings just as we do, yet he was obedient to God’s word. That obedience gave God an opportunity to answer his prayers.
In the gospel of John 15:7, Jesus says: “If you live in me and what I say lives in you, then ask for anything you want, and it will be yours.”, in the KJV it says: If ye abide in me, and my words abide in you, ye shall ask what ye will, and it shall be done unto you. So look at the sections in this verse. First it says to abide or live in God, this is the obedience. Second it says to let His word live or abide in us. Third it says what you pray will be answered. So what a promise when we just choose to obey God.