|When you ask, you do not receive, because you ask with wrong motives, that you may spend what you get on your pleasures.|
|Ye ask, and receive not, because ye ask amiss, that ye may consume it upon your lusts.|
In James 4 the author, James, is specifically speaking about prayers seeking our own worldly gain and not God's glory.
Prayer is a blessing to each of us -- the constant ability to commune with the Almighty. When we go to God in prayer, it's important to understand that God knows what's best for us. We may not understand now or in this lifetime, but He does.
Our ultimate goal and privilege is to bring glory to God in our lives. James is asking us to look into our hearts and submit ourselves and our prayers to Christ and not our own selfish desires.
Look into your own life and examine the heart of your prayers. To God be the glory.