In my web pages I have 2 lists of items which are loaded from DB. To decrease traffic I store all items loaded from DB in global array and when the user searches the list, I search the array first and only when the item is not found I go to the DB.
So at first I define my global array at the top of my script and only once.
var _navArr=[];
And then I want to access it with this code
$.ajax({ //At breakpoint here the _navArr is defined and full of items
type: "POST",
url: "Webservices/ws_publikace.svc/ws_getUserNavigatorList",
data: data,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
//But inside success function _navArr is undefined
_navArr[navArr] = extedItemArr(_navArr[navArr], msg.d);
}
});
But it doesn't work as described in the code.
Any Idea why is it so? Thanks
Instead var _navArr=[];
try window._navArr = [];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.