Refactored javascript.
post.js