Switch from $.post to $.ajax