简体   繁体   English

在表单发布后在php中调用jquery函数,通知不显示

[英]calling jquery function in php after form post, the notification doesnt show

$result=$db->add_tender($t_name,$t_code,$t_category,$discription,$s_funds,$price,$deadline,$apply_to,$contact,$t_status,$_SESSION["VALID_USER_IDENTITY"]);

     if($result==false){

         $Err="Some thing went Wrong!-->".$result;
     }
     else{

         $last_id=$result;
        $message="Tender Successfully Added!";

   ?>
 <script type="text/javascript">
                    function showAutoCloseMessage(){
                        showNotification({
                            message: ""<?php echo $message; ?>",
                            autoClose: true,
                            duration: 2
                        });    
                    }                                
                </script>
   <?php
    //header('Location:v_tender.php?t_id='.$last_id);

    //header('Location:view_tenders.php');

     }

Replace belo code 替换belo代码

showNotification({
     message: ""<?php echo $message; ?>",
     autoClose: true,
     duration: 2
});   

By 通过

$(document).ready(function(){
    showNotification({
         message: "<?php echo $message; ?>",
         autoClose: true,
         duration: 2
    });   
});

because "" is treated as string is closed but string not closed there. 因为“”被视为字符串已关闭,但字符串未在此处关闭。 also it gives error in console. 也给控制台带来了错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM