开发者

Silverlight 4.0: Safari and XMLHttpRequest

开发者 https://www.devze.com 2023-04-09 09:17 出处:网络
function releaseUser(user) { 开发者_运维百科if (user != null) { var requestParams = \"\", url = \"\", number = 0, type = \"\";
function releaseUser(user) {

  开发者_运维百科      if (user != null) {
            var requestParams = "", url = "", number = 0, type = "";
            /* Configure Parameters */
            url = readCookie("endpointaddress");
            requestParams = "<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">";
            requestParams = requestParams + "<soap:Body><ReleaseUser xmlns=\"http://Test.Test.CaseHistory/\">";
            requestParams = requestParams + "<credentials>" + user + "</credentials></ReleaseUser></soap:Body></soap:Envelope>";
            /* Send XML/SOAP Request To Web Service Using Browser's Javascript DOM */
            try {
                releaseUserRequest = new XMLHttpRequest();
            }
            catch (trymicrosoft) 
            {
                try {
                    releaseUserRequest = new ActiveXObject("Msxml2.XMLHTTP");
                }
                catch (othermicrosoft) {

                    try {
                        releaseUserRequest = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    catch (failed) {
                        releaseUserRequest = false;
                    }
                }
            }
            releaseUserRequest.open("POST", url, true);
            releaseUserRequest.setRequestHeader("Content-Type", "text/xml;charset=utf-8");
            releaseUserRequest.onreadystatechange = releaseUserState;
            releaseUserRequest.send(requestParams);
            **alert(releaseUserRequest.responseText);**
        }
    }

    function releaseUserState() {
        if (releaseUserRequest.readyState == 4) {
            if (releaseUserRequest.status == 200) {
                **alert(releaseUserRequest.responseText);**
            }**alert(releaseUserRequest.responseText);**
        }
    }

The code above is my Silverlight server page and is working in Firefox and IE but NOT in Safari. releaseUser function calls the web service method when the user click browser close.

OS: Windows 7

Is their anything that I've missed in Safari configuration? Thanks

0

精彩评论

暂无评论...
验证码 换一张
取 消