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

时间:2016-08-01 11:05:43

标签: php jquery

$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');

     }

1 个答案:

答案 0 :(得分:0)

替换belo代码

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

通过

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

因为&#34;&#34;被视为字符串已关闭但字符串未关闭。它也会在控制台中出错。