Click here to Skip to main content
11,409,450 members (65,849 online)
Rate this: bad
good
Please Sign up or sign in to vote.
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 26-Nov-12 0:52am
074051.1K
Edited 26-Nov-12 22:59pm
v3

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 8,676
1 OriginalGriff 6,885
2 Maciej Los 3,322
3 Abhinav S 3,238
4 Peter Leow 3,034


Advertise | Privacy | Mobile
Web03 | 2.8.150414.5 | Last Updated 27 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100