CHtml ajaxLink example01

 1 <?php 
 2     $display=$MessageNotificationSwitch==1?'block':'none';
 3     echo CHtml::ajaxLink(
 4     $text = 'Edit Audio', 
 5     $url = $this->createUrl('companysetting/getOption',array('key'=>'MessageNotificationAudioId')), 
 6     $ajaxOptions=array (
 7         'type'=>'POST',
 8         'dataType'=>'json',
 9         'success'=>'function(data){
10             if(typeof(data)!=="undefined"){
11                 if(parseInt(data.option_value)==1){
12                     $("input[name=MessageNotificationType]:eq(0)").attr("checked","checked");
13                     $("#MessageNotificationImport").hide();
14                     $("#MessageNotificationDefault").show();
15                 }else{
16                     $("input[name=MessageNotificationType]:eq(1)").attr("checked","checked");
17                     $("#MessageNotificationImport").show();
18                     $("#MessageNotificationDefault").hide();
19                 }
20                 $.post("'.$this->createUrl('companysetting/getOption',array('key'=>'MessageNotificationCustom')).'",{},function(data){
21                     if(typeof(data)!=="undefined"){
22                         if(data.option_value!=="" || data.option_value==null){
23                             $("#MessageNotificationImportPlay").show();
24                             bindVoice("jp_mn_1","jp_mn_c_1","/audio/personalization/default/message_notification.wav");
25                             bindVoice("jp_mn_2","jp_mn_c_2",data.option_value);
26                         }else{
27                             $("#MessageNotificationImportPlay").hide();
28                         }
29                     }
30                 },"json");
31                 $("#MessageNotificationWindow").dialog("open");
32             }
33         }'
34     ), 
35     $htmlOptions=array('style'=>"display:$display;",'id'=>'MessageNotificationCustomWindow')
36     );
37 ?>
posted @ 2014-07-24 15:02  haishi633  阅读(107)  评论(0编辑  收藏  举报