theres also a ignition relay that could be bad. you can swap the relays in the fuse box.
typically i try not to say go buy a new this or that with out playing with a thing or two for free to make sure your not tossing good money out the window. just shotgunning parts for no reason other then suspicion is wrong. especially when the pos battery cable has fallen off the starter.
and yes the hammer hitting, if it works is only a temp fix, thats why i said "if" it works to go buy a new starter.
and just a bit more help, 99% of the time the starter motor is just fine, its the starter solenoid that goes bad and its change able for about 30 bucks or less. way less then a new starter or even a rebuilt one. the starter solenoid is what all the wires bolt on too.