diff --git a/src/pat/push/push.js b/src/pat/push/push.js index d260f3751..1ad2bca35 100644 --- a/src/pat/push/push.js +++ b/src/pat/push/push.js @@ -17,6 +17,20 @@ define( $(document.body).on("push", function (e, data) { logger.debug('received push marker'); if (data === this.options.pushId) { + // TODO: use async / await in here in the future and simplify code + if (this.$el.is("form")) { + var url = this.options.url || this.$el.attr("action") || false; + if (url) { + var action = this.$el.attr("method").toLowerCase() === "post" ? "post" : "get"; + $[action]({ + url: url, + data: $(this).serializeArray() + }).success(() => this.perform_inject()); + // injection already done in case of successful submit. + // return now. + return; + } + } this.perform_inject(); } }.bind(this));