Click here to Skip to main content
Sign Up to vote bad
good
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 25-Nov-12 23:52pm
074051.1K
Edited 26-Nov-12 21:59pm


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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Christian Graus 544
1 OriginalGriff 258
2 Ron Beyer 256
3 samadhan_kshirsagar 229
4 Sergey Alexandrovich Kryukov 193
0 Sergey Alexandrovich Kryukov 7,007
1 Prasad_Kulkarni 3,815
2 OriginalGriff 3,557
3 _Amy 3,372
4 CPallini 2,975


Advertise | Privacy | Mobile
Web04 | 2.6.130617.1 | Last Updated 27 Nov 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid