The Eagles had the perfect start to the contest when defensive end Trent Cole got to Cardinals quarterback Carson Palmer and stripped him of the ball and defensive tackle Bennie Logan gathered it on the Arizona 25.
The Cardinals responded and got on the board when Palmer fired a strike over the middle of the field for Larry Fitzgerald and he bounced off two tackles and was presented with an open field to run into the endzone for a 43-yard touchdown.
Philadelphia put 10 points up just before the break as Alex Henery fired a 32-yard field goal through the posts.
Then the home side took advantage of a pass interference call in the endzone on Riley Cooper that moved them to to the one-yard line and Foles threw a pass to Brent Celek on a crossing route for the score.
After half time, the Eagles upped the ante and Ertz got his second touchdown of the game as he got open down the seam and Foles drilled a pass to him to make the grab for the 24-yard score.
The Cardinals came back into the game as Palmer rallied his side and moved them downfield before rifling a pass to Michael Floyd at the back of the endzone for a 23-yard touchdown in tight coverage.
Philadelphia were struggling to put points on the board and that almost came back to haunt them as in the fourth quarter.
Arizona brought themselves within three points as Palmer found his tight end Jim Dray on a corner route for a three-yard score off a play-action pass.
Palmer had the ball late in the game to try and win the game for his side but he could not move the chains as the Eagles defense held firm to win the match to move to 7-5 in their season.