changed $('form').submit(); to $('#form').submit();