Click here to Skip to main content
15,889,909 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
My code is:

var userName = document.getElementById("txtSearch").value;
    var xhr = new XMLHttpRequest();
    xhr.open("POST", "http://www.rest.net/services/abc.svc/json/GetXml", true);
    xhr.responseType = "text";
    xhr.setRequestHeader("Content-Type", "text/xml;charset=UTF-8");
    var packet = '<?xml version="1.0" encoding="utf-8" ?><CompanyRequest xmlns="http://schemas.datacontract.org/2004/07/abc.DomainModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><CompanyName>company</CompanyName></CompanyRequest>';
    xhr.onreadystatechange = function () {
        if (xhr.readyState==xhr.DONE) {              
            var parser = new DOMParser();
            var response = parser.parseFromString( xhr.responseText, "text/xml");
            var n = response.getElementsByTagName("CompanyResponse");               
            for (var i = 0; i < n.length; i++) {
                var p = n[i].getElementsByTagName("CompanyList");
                for (var j = 0; j < p.length; j++) {
                    var l = p[j].getElementsByTagName("Company");
                    for (var k = 0; k < l.length; k++) {
                        var a = l[k].getElementsByTagName("Id")[0].firstChild.nodeValue;
                        if (a != null) {
                            sessionStorage.setItem(1, a);
                            WinJS.Navigation.navigate("Search.html");
                        }
                    }
                }
            }
        }
    }

    xhr.send(packet);


I am very new to this. I want to navigate to search.html page on button click. But it is not going so...what's wrong with it i cant understand...help me..

Thanks in advance..........
Posted
Updated 26-Nov-12 21:59pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900