javascript - Alert msg box display blank page behind -


i displaying message box @ client browser. works fine see blank page @ when alert message box pops up. want user see browsing page , pop message box. here code.` if($_post['submit']=="save") {

  $language=$_post['pbx_lan'];    if($language!="")   {    $query="update `account_detail` set `prompt_language`= '$language' `org_id`='".$_session['account_id']."'";   $result = $mysqli->query($query) or die($mysqli->error);     $_session['check_update'] = "1";   // setcookie("msg","language updated",time()+5,"/");    echo '<script>   confirm("you have selected '.$language.'");   window.location = "'.site_url.'index.php?view=pbx_prompts."   </script>';    // header("location:".site_url."index.php?view=view_service");    }    else   {   setcookie("err","no language selected.please select language",time()+5,"/");   header("location:".site_url."index.php?view=view_service");   }    }`  

when confirm() called page stops loading. when add confirm() @ end of page, page loaded before confirm() shown

<body>     test123     <script>         confirm('test');     </script> </body> 

instead of

<body>     <script>         confirm('test');     </script>     test123 </body> 

for code means

 echo '<script>   confirm("you have selected '.$language.'");   window.location = "'.site_url.'index.php?view=pbx_prompts."   </script>'; 

has move bottom of body tag copy required if statements code executed when neccesary.

the complete code @ bottom of body tag should this:

if (!empty($language) && $_post['submit'] == "save") {       echo '<script>          confirm("you have selected '.$language.'");          window.location = "'.site_url.'index.php?view=pbx_prompts."       </script>'; } 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -