Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript XDomainRequest POST与XML…我做错了什么?_Javascript_Xml_Wcf_Post_Xdomainrequest - Fatal编程技术网

Javascript XDomainRequest POST与XML…我做错了什么?

Javascript XDomainRequest POST与XML…我做错了什么?,javascript,xml,wcf,post,xdomainrequest,Javascript,Xml,Wcf,Post,Xdomainrequest,这(希望)是一个简单的问题。我必须使用XDomainRequest通过POST向web服务提交请求。我在互联网上找到了关于这一点的稀疏文档,但我不相信没有人知道这一点 以下是我的XDomainRequest代码: var testURL = 'http://localhost:4989/testendpoint'; //let us check to see if the browser is ie. If it is not, let's if ($.browser.msie &

这(希望)是一个简单的问题。我必须使用XDomainRequest通过POST向web服务提交请求。我在互联网上找到了关于这一点的稀疏文档,但我不相信没有人知道这一点

以下是我的XDomainRequest代码:

var testURL = 'http://localhost:4989/testendpoint';

//let us check to see if the browser is ie.  If it is not, let's 
if ($.browser.msie && window.XDomainRequest) {
    var xdr2 = new XDomainRequest();
    xdr2.open("POST", testURL);
    xdr2.timeout = 5000;
    xdr2.onerror = function () {
        alert('we had an error!');
    }
    xdr2.onprogress = function () { 
        alert('we have some progress!');
    };
    xdr2.onload = function () {
        alert('we load the xdr!');

        var xml2 = new ActiveXObject("Microsoft.XMLDOM");
        xml2.async = true;
        xml2.loadXML(xdr2.responseText);
    };

    //what form should my request take to be sending a string for a POST request?  
    xdr2.send("thisisastring");
}
My web service(WCF)根据web service的帮助页接受一个参数,如下所示:

<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">String content</string>

因此,我很确定问题在于如何使用XDomainRequest。

如果有人遇到这个问题,我最终会将我的web服务转换为返回JSON格式的数据。使用JSON消除了对XDomainRequest的需求,允许我使用传统的ajax jquery工具

你找到解决办法了吗。我也面临同样的问题。在我制定职位要求之前,我换了工作。接下来,我将其转换为JSON。我不确定你是否可以在IE中发布JSON,但我想看看这个:在我换工作之前。很抱歉
xdr2.send("thisisastring");
xdr2.send("<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">thisisastring</string>");
LOG:undefined