Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to get property of undefined or null reference - Windows 8 JS/CSS app
    primarykey
    data
    text
    <p>Below is a snippet of my code. The error I am getting is that when I perform a search and call the method <code>_searchData</code>, it successfully calls the method <code>_lookUpSuccess</code>, however then returns the following error:</p> <p><strong>JavaScript runtime error: Unable to get property '_displayResult' of undefined or null reference</strong></p> <p>when it tries to call the <code>_displayResult</code> method.</p> <p>Why this may be? </p> <pre><code>(function () { // make this an object property/method eventually var displayResult = function (queryResult) { for (var i = 0; i &lt; holder.length; i++) { //document.querySelector(".item-content .title").textContent = "FilmApp"; document.querySelector(holder[i]).textContent = queryResult[i]; }}; // Creates a new page control with members ui.Pages.define(searchPageURI, { //... _searchData: function (queryText) { searchBase = 'http://www.example.com/web-service2.php?termID='; searchFormat = 'JSON'; searchFormatPiece = '&amp;format=' + searchFormat; if (!window.Data) { var searchUrl = searchBase + queryText + searchFormatPiece; WinJS.xhr({ url: searchUrl }).done(this._lookUpSuccess, this._lookUpFail, this._lookUpProgress); }else{ document.querySelector(".titlearea .pagetitle").textContent = "There has been a computer malfunction - sort it the **** out!"; } }, _lookUpSuccess: function xhrSucceed(Result) { var response = JSON.parse(Result.responseText); if (response.response[0].Message === "Found") { for (var x in response.response[1].term) { content.push(response.response[1].term[x]); }; this._displayResult(content); //displayResult(content); return content; } else { content.push("Not Found", "Not Found"); return content; } }, _lookUpFail: function xhrFail(Result) { document.querySelector(".titlearea .pagetitle").textContent = "Got Error"; }, _lookUpProgress: function xhrProgress(Result) { document.querySelector(".titlearea .pagetitle").textContent = "No Result 2"; }, _displayResult: function (queryResult) { var holder; holder = [DefDiv, DescDiv]; for (var i = 0; i &lt; holder.length; i++) { //document.querySelector(".item-content .title").textContent = "FilmApp"; document.querySelector(holder[i]).textContent = queryResult[i]; }; }, }); // End of UI.page.define // #2 This method is run on application load WinJS.Application.addEventListener("activated", function (args) { if (args.detail.kind === appModel.Activation.ActivationKind.search) { args.setPromise(ui.processAll().then(function () { if (!nav.location) { nav.history.current = { location: Application.navigator.home, initialState: {} }; } return nav.navigate(searchPageURI, { queryText: args.detail.queryText }); })); } }); // #3 appModel.Search.SearchPane.getForCurrentView().onquerysubmitted = function (args) { nav.navigate(searchPageURI, args); }; })(); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload