如何通过XDomainRequest POST方法接收变量? [英] How can receive variables through XDomainRequest POST method?

查看:138
本文介绍了如何通过XDomainRequest POST方法接收变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个跨域问题。

IE8:
xdr = new XDomainRequest();
xdr.open(" POST", http://example.com/test.php );
xdr.send("data=Testdata&value=123456");    

问题是:
如何通过服务器端的POST方法(如PHP或ASP)接收发送值?


GET方法运行良好,但POST方法无效。因为如果你POST一些值,HTTP头必须是:"application / x-www-form-urlencoded",XDR对象contentType是Readonly,所以你不会收到POST值。

This is a Cross Domain problem.

IE8:
xdr = new XDomainRequest();
xdr.open("POST", http://example.com/test.php);
xdr.send("data=Testdata&value=123456");    

The question is :
how can I receive the send values through POST method at server side(like PHP or ASP)?


The GET method is work well, but POST method con't work. Because if you POST some values, the HTTP Head must be: "application/x-www-form-urlencoded", the XDR object contentType is Readonly, so you will not receive the POST values.

推荐答案

嗯,我担心我不知道你怎么能从客户那里做到这一点。 Afaik XDR对象甚至不发送内容类型标头。因此,您的服务器需要仅根据动词将请求传递给ASP / PHP。

Hmmm, I'm afraid I'm not sure how you can do this from the client. Afaik the XDR object doesn't even send a content-type header. So instead your server will need to pass the request to ASP/PHP based just on the verb.


这篇关于如何通过XDomainRequest POST方法接收变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆