gjshah7254
5/4/2015 - 11:35 PM

Kentico Page reload Ajax event without refresh of whole page

Kentico Page reload Ajax event without refresh of whole page

      var pageRequestManager = Sys.WebForms.PageRequestManager.getInstance();
			pageRequestManager.add_pageLoaded( onPageLoaded );

			if (!pageRequestManager.get_isInAsyncPostBack()) {
				pageRequestManager.add_beginRequest(BeginRequest);
				pageRequestManager.add_endRequest(EndRequest);
			}

			function BeginRequest(sender, args) {
			}

			function EndRequest(sender, args) {
			}

			function onPageLoaded( sender, args ) {//Loads everytime a page loads
				console.log("panel updated");
				
			  var panels = args.get_panelsUpdated();
				if ( panels.length ) {//Only happens when it is a postback
					console.log("async panel update");
				}
			}