Skip to content
Permalink
Browse files

use application/x-www-form-urlencoded for message POST

  • Loading branch information...
devnewton committed May 3, 2017
1 parent f090e88 commit 15372ace7884eb00236b6ddfa12918b75d64a5c7
Showing with 10 additions and 8 deletions.
  1. +3 −1 .gitignore
  2. +1 −1 index.php
  3. +6 −6 js/taab.js
@@ -1 +1,3 @@
/nbproject/
/nbproject/
/.buildpath
/.project
@@ -8,7 +8,7 @@
</head>
<body class="c-text">
<main id="taab-coincoin" class="o-container o-container--super u-window-box--tiny" v-on:click="clicked" v-on:mouseover="mouseEntered" v-on:mouseout="mouseLeaved">
<form class="c-input-group" v-on:submit.prevent="post" accept-charset="UTF-8" autofocus>
<form class="c-input-group" v-on:submit.prevent="post" accept-charset="UTF-8" enctype="application/x-www-form-urlencoded" autofocus>
<div class="o-field">
<input v-model="message" ref="message" name="message" placeholder="message or command (/nick)" class="c-field" spellcheck="true">
</div>
@@ -14,7 +14,6 @@ document.addEventListener('DOMContentLoaded', function () {
this.message = "";
} else {
var self = this;
var form = e.target;
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
@@ -24,14 +23,15 @@ document.addEventListener('DOMContentLoaded', function () {
}
}
};
var body = new FormData(form);
xhr.open("POST", "post.php");
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
var params = "message=" + encodeURIComponent(this.message).replace(/%20/g, '+');
var login = localStorage.login;
if (login) {
body.append("login", login);
params += "&login=" + encodeURIComponent(login).replace(/%20/g, '+');
}
body.append("lastId", self.getLastId());
xhr.open("POST", "post.php");
xhr.send(body);
params += "&lastId=" + self.getLastId();
xhr.send(params);
}
},
get: function () {

0 comments on commit 15372ac

Please sign in to comment.
You can’t perform that action at this time.