0

I need to catch Ispostback event using javascript for some purpose. I found many example in google but none of them has worked for me. Like one example i used which is below:

$(document).ready(function () {
   var chkPostBack = '<%= Page.IsPostBack ? "true" : "false" %>';
        if (chkPostBack == 'true') {
            alert("Ispostback alert");
        }
        
});

But this is not working.

V.Prasad
  • 131
  • 4
  • 19
  • Have you already seen this post: https://stackoverflow.com/questions/1857606/how-to-detect-track-postback-in-javascript? – Tetsuya Yamamoto Jul 28 '17 at 07:29
  • Yes this i have tried also but it is also not working. – V.Prasad Jul 28 '17 at 07:30
  • Also check for another suggestion: https://stackoverflow.com/questions/59719/how-can-i-check-for-ispostback-in-javascript. Provide additional details if you feel current code is not complete enough. – Tetsuya Yamamoto Jul 28 '17 at 07:38
  • I have checked this example also as given here i used if condition to check ispostback in pageload event code behind then i put javascript function first outside of document.ready function. It was not working then i put this function inside document.ready but that one is also not working. – V.Prasad Jul 28 '17 at 07:45
  • It is working just fine. I get an alert on PostBack. – VDWWD Jul 28 '17 at 09:04
  • which solution you used the one which i mentioned here? if yes then how did you used. Please explain. – V.Prasad Jul 28 '17 at 09:07

0 Answers0