一、AJAX回调div设置
[code type="css"]#tailresult{border:1px solid #d4d4d4; background:#FFC; padding:8px 70px; margin:2px 15px; line-height:185%; color:red; font-weight:bold;float:right;position:absolute;right:100px;display:none;}[/code]
<div id="tailresult" style="font-family:微软雅黑,Tahoma;letter-spacing:2px"></div>
二、AJAX的写法
[code type="javascript"]
[/code]
PHP 页面:
[code]
public function del_stu_think(){
$id = $_REQUEST['id'];
$think = M("thinking");
if(!empty($id)){
if($think->where("id='$id'")->delete()){
$this->ajaxReturn($id,'删除成功',1); #第一个值为 data 第二个为 返回显示提示信息 第三个为状态
}else{
$this->ajaxReturn($id,'删除失败',0);
}
}
}
[/code]
页面返回html中使用 $ 操作 借用原来的 jquery 里面的元素 不需要 加 #号
例如:
$('list').remove();
获取控件值:
var start_time = $("b_date").value;
+++++++++++++++++++++JESON AJAX 访问+++++++++++++++++++++++++++++++
[code]
//打开弹出窗口
function class_demo(scid,stuid,ordid,sta_date,end_date,stet){
j.getJSON("/index.php/Course/ajax_classinfo/scid/"+scid+"/stuid/"+stuid+"/ordid/"+ordid+"/sta_date/"+sta_date+"/end_date/"+end_date,function(data){
document.getElementById("show_data").innerHTML = data;
var offsetTop = j(window).scrollTop() + 80 +"px";
if(stet==1){
j("#show_software").show();
}
j("#show_teacher_result").css("top",offsetTop);
j("#show_teacher_result").fadeIn(300);
});
}
PHP
function ajax_classinfo(){
$arr = $index->where($where)->select();
$str = $arr['list']['lsc_title']."
";
$str .= '老师:'.$arr['list']['teachername']."
";
$str .= "".date("H:i",$arr['list']['bgtime'])."--".date("H:i",$arr['list']['endtime'])."
";
$str .= $arr['list']['lsc_classcon']."
";
if($arr['list']['lws_id']==''){
$str .= "
";
}
$tutor = json_encode($str);
echo $tutor;
}
[/code]
<include file="../Public/_header" /> 包含
<label><input name="sex" type="radio" value="1" <eq name="sex" value="1">checked</eq>>男</label>
<label><input name="sex" type="radio" value="0" <neq name="sex" value="1">checked</neq>>女</label>
三、标签里面直接加PHP的写法:
- 用户组:
-
if($type=='add'){ {:W('SelectUserGroup')}}else { {:W('SelectUserGroup', array('uid'=>$uid))}}