Changed the processing from javascript to PHP.