Friday, February 20, 2015

Getting data from a webservice using an AJAX call

            url: SERVICEURL,
            type: "GET",
            headers: { "accept": "application/json;odata=verbose" },
            async: false,
            crossDomain: true,
            success: function (data) {
                var email = data.getElementsByTagName("person")[0].getElementsByTagName("email")[0]; //email is the field returned by the service
                if (email != null && email != undefined)
                    document.getElementById('lblEmail').innerHTML = email[0].childNodes[0].nodeValue
            error: function (xhr) {
                console.log(xhr.status + ': ' + xhr.statusText);

No comments:

Post a Comment

How to launch a document by clicking a link to the file?

Word: <a href='ms-word:ofe|u|path/to/web/word/document.docx'>Link to document</a> Excel: <a href='ms-excel:o...