1)
How did David ask Hashem?
1.
'Rashi': It was via the Urim v'Tumim.
2)
Why did David ask if he should ascend to the Pelishtim?
1.
Radak (Shmuel II, 5:19): Ba'al Peratzim was higher than the Metzudah to which David descended.
2.
Malbim: One who goes from the Midbar to [Emek Refa'im, which is near] Yerushalayim, he ascends.


