Browse Source

Send valid request on posting

Rafał Pitoń 10 years ago
parent
commit
20d3699847
1 changed files with 7 additions and 3 deletions
  1. 7 3
      misago/static/misago/js/misago-posting.js

+ 7 - 3
misago/static/misago/js/misago-posting.js

@@ -100,6 +100,8 @@ $(function() {
 
     this._clear = function() {
 
+      this.options = null;
+
       this.$spacer = null;
       this.$container = null;
       this.$form = null;
@@ -132,6 +134,8 @@ $(function() {
         return false;
       }
 
+      this.options = options;
+
       this.$form = $('#posting-form');
       this.$container = this.$form.parent();
       this.$spacer = this.$container.parent();
@@ -299,7 +303,7 @@ $(function() {
         this.$ajax_loader.addClass('in');
 
         var form_data = this.$form.serialize() + '&submit=1';
-        $.post(options.api_url, form_data, function(data) {
+        $.post(this.options.api_url, form_data, function(data) {
           _this.$ajax_loader.removeClass('in');
           if (data.post_url !== undefined) {
             _this.posted = true;
@@ -314,10 +318,10 @@ $(function() {
             if (on_post) {
               _this.$ajax_complete.addClass('in');
 
-              var past_location = String(window.location.href);
+              var post_location = String(window.location.href);
               window.location.href = data.post_url.replace('#post', '#goto-post');
 
-              if (past_location.indexOf(window.location.href)) {
+              if (post_location.indexOf(window.location.href)) {
                 window.location.reload();
               }
             }