Fix indentation and coding standard issues
Showing
2 changed files
with
9 additions
and
14 deletions
... | @@ -244,27 +244,22 @@ | ... | @@ -244,27 +244,22 @@ |
244 | this.getBinary = function(url, method, data) { | 244 | this.getBinary = function(url, method, data) { |
245 | try { | 245 | try { |
246 | var xhr = new XMLHttpRequest(); | 246 | var xhr = new XMLHttpRequest(); |
247 | if(method === undefined || ["GET","get","POST","post"].indexOf(method) == -1) | 247 | if (method === undefined || ["GET","get","POST","post"].indexOf(method) == -1) { |
248 | { | ||
249 | method = "GET"; | 248 | method = "GET"; |
250 | }else{ | 249 | } else { |
251 | method = method.toUpperCase(); | 250 | method = method.toUpperCase(); |
252 | } | 251 | } |
253 | 252 | ||
254 | xhr.open(method, url, false); | 253 | xhr.open(method, url, false); |
255 | this.log("Using HTTP method: '" + method + "'", "debug"); | 254 | this.log("using HTTP method: '" + method + "'", "debug"); |
256 | xhr.overrideMimeType("text/plain; charset=x-user-defined"); | 255 | xhr.overrideMimeType("text/plain; charset=x-user-defined"); |
257 | if(method == "POST") | 256 | if (method == "POST") { |
258 | { | 257 | if(data === undefined) { |
259 | if(data === undefined) | ||
260 | { | ||
261 | data_str = ""; | 258 | data_str = ""; |
262 | }else{ | 259 | } else { |
263 | data_str = ""; | 260 | data_str = ""; |
264 | for(k in data) | 261 | for (k in data) { |
265 | { | 262 | if (typeof(k) == "string" && typeof(data[k]) == "string") { |
266 | if(typeof(k) == "string" && typeof(data[k]) == "string") | ||
267 | { | ||
268 | data_str += "&" + escape(k) + "=" + escape(data[k]); | 263 | data_str += "&" + escape(k) + "=" + escape(data[k]); |
269 | } | 264 | } |
270 | } | 265 | } |
... | @@ -272,7 +267,7 @@ | ... | @@ -272,7 +267,7 @@ |
272 | } | 267 | } |
273 | xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); | 268 | xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); |
274 | } | 269 | } |
275 | this.log("Using request data: '" + data_str + "'", "debug"); | 270 | this.log("using request data: '" + data_str + "'", "debug"); |
276 | xhr.send(method == "POST" ? data_str : null); | 271 | xhr.send(method == "POST" ? data_str : null); |
277 | return xhr.responseText; | 272 | return xhr.responseText; |
278 | } catch (e) { | 273 | } catch (e) { | ... | ... |
-
Please register or sign in to post a comment