js脚本中try与cache捕获异常处理

时间:2022-08-28 11:43:19
 <script type="text/javascript">
 function add_reason(elm){
     try{
         var pp=$('.pp').val();
         var contents=$('.pp2').val();
         if(pp==0){
             throw "请先选择品类";
         }
         if(!contents){
             throw "请先输入故障描述内容";
         }
         $('form').submit();
     }catch(err){
         art.dialog({
             drag: false,
             resize: false,
             title:'温馨提示',
             content: err,
         });
     }
 }
 </script>