nborpe
nborpe

Reputation: 199

How to hide alert box in javascript

I want to hide the alert box. Alert box at last line pops up first, after that when ajax call completes other alert box in if condition pops up, which pops up below the first one.

I want to hide the first alert box when second one pops up.

     var xmlhttp;    
     if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
      } else {// code for IE6, IE5
         xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
      xmlhttp.onreadystatechange=function() {
         if (xmlhttp.readyState==4) {
            if(xmlhttp.status==200) {               
               alert(getLocalizedString("partialExportFCdata_ui.msg3");
            }else{
               alert(getLocalizedString("partialExportFCdata_ui.msg4");
            }
         }
         var obj = document.getElementById("ChkBoxHeader");
         checkAll(false, obj.name);
      }
      xmlhttp.open("POST","FCTagService?    htmlaction=updateTags&records="+sb.toString()+"&containsid="+containsid+"&catalogIdStr="+catalogIdStr, true);
      xmlhttp.send();
      alert(getLocalizedString("partialExportFCdata_ui.msg7"); //Last alert box

Upvotes: 0

Views: 2812

Answers (2)

Akshay Khale
Akshay Khale

Reputation: 8371

Browser's build in Popup messages are not good to use in such context, you should make use of some jquery component for doing this. Alert dialog box should mainly used for debugging purpose.

Upvotes: 1

Andrey Popov
Andrey Popov

Reputation: 7510

You cannot. This is browser specific and so you cannot control it. You can simply force it to show.

Upvotes: 3

Related Questions