I had similar trouble, in my case it was because Http.js always sets
the content type to 'application/x-www-form-urlencoded' - so your
'text/json' gets overwritten. I made these changes to Http.js:
Add to the class:
getHeader: function(key) {
return (this.headers[key] != undefined) ? this.headers[key] :
null;
},
Then change:
if (this.method == 'POST') {
this.setHeader('Content-length',
this.body.join('&').length);
this.setHeader('Content-Type', 'application/x-www-form-
urlencoded');
}
to:
if (this.method == 'POST') {
if (this.getHeader('Content-Type') == null) {
this.setHeader('Content-Type',
'application/x-www-form-
urlencoded');
}
this.setHeader('Content-length',
this.body.join('&').length);
}
then in your server side JS you can do:
var request = new Http('http://127.0.0.1/getting.php');
request.set('method', 'POST');
request.setHeader('Content-Type', 'application/json');
.....
Hope that helps.
On Apr 17, 1:21 am, erSan <[email protected]> wrote:
> Hi,
>
> When, on server side, using
>
> var request = new Http('http://127.0.0.1/getting.php');
> request.set('method', 'POST');
> request.setHeader('meta', 'http-equiv="content-type" content="text/
> json; charset=utf-8"');
> var m = JSON.encode({cmd:"get-opened"});
> request.write(m);
> request.getContent(function(result)
> {
> var res = JSON.decode(result);
>
> });
>
> then sending res via sendRaw to client the accents are lost.
>
> when client post same request with dojo.rawXhrPost results OK.
>
> somebody can it help me..
>
> Thanks
--
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/