Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #21930 > unrolled thread

json, encoding and ajax

Started byAndrew Poulos <ap_prog@hotmail.com>
First post2013-11-08 20:06 +1100
Last post2013-11-08 19:19 +0100
Articles 4 — 4 participants

Back to article view | Back to comp.lang.javascript


Contents

  json, encoding and ajax Andrew Poulos <ap_prog@hotmail.com> - 2013-11-08 20:06 +1100
    Re: json, encoding and ajax Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-11-08 10:43 +0100
    Re: json, encoding and ajax Denis McMahon <denismfmcmahon@gmail.com> - 2013-11-08 17:41 +0000
    Re: json, encoding and ajax Christoph Michael Becker <cmbecker69@arcor.de> - 2013-11-08 19:19 +0100

#21930 — json, encoding and ajax

FromAndrew Poulos <ap_prog@hotmail.com>
Date2013-11-08 20:06 +1100
Subjectjson, encoding and ajax
Message-ID<WpOdnUN-mJ1PNOHPnZ2dnUVZ_tCdnZ2d@westnet.com.au>
If I'm sending json to the server does it need to be encoded eg using 
encodeURIComponent?

Andrew Poulos

[toc] | [next] | [standalone]


#21931

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2013-11-08 10:43 +0100
Message-ID<2637418.jWlWchTPjn@PointedEars.de>
In reply to#21930
Andrew Poulos wrote:

> If I'm sending json to the server does it need to be encoded eg using
> encodeURIComponent?

<http://tools.ietf.org/html/rfc2616>

-- 
PointedEars

Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#21936

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2013-11-08 17:41 +0000
Message-ID<l5j7p1$qag$1@dont-email.me>
In reply to#21930
On Fri, 08 Nov 2013 20:06:39 +1100, Andrew Poulos wrote:

> If I'm sending json to the server does it need to be encoded eg using
> encodeURIComponent?

How are you sending it? If you're passing it in a get request, then it 
may well need uri encoding, however if you're passing it as if it were a 
form text field from a post request, then I think as long as the type for 
the form data is set (multipart/form-data?) and the character encoding is 
ok, you should be fine.

-- 
Denis McMahon, denismfmcmahon@gmail.com

[toc] | [prev] | [next] | [standalone]


#21938

FromChristoph Michael Becker <cmbecker69@arcor.de>
Date2013-11-08 19:19 +0100
Message-ID<527d2b4a$0$6629$9b4e6d93@newsspool2.arcor-online.net>
In reply to#21930
Andrew Poulos wrote:

> If I'm sending json to the server does it need to be encoded eg using
> encodeURIComponent?

As others have already pointed out, that depends on the HTTP method
(GET/POST/...) and as applicable the Content-Type of the request.  If
you want to send a JSON text solely as a POST request, you may choose
Content-Type: application/json.  In this case the JSON text does not
have to be percent encoded.

-- 
Christoph M. Becker

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web