ajax传值提交

2016-11-23 19:33:34来源:CSDN作者:leesin2011人点击

第七城市
HTML:<script type="text/javascript">	$(document).ready(function(){		$("#save").click(function(){			$.ajax({				type : "POST",				url : "/?t={{'elearning'|encrypt}}&m={{'mytask'|encrypt}}&a={{'review'|encrypt}}",				data :"id={{$log.logid}}&review="+$('input:radio:checked').val(),				dataType : 'json',				success : function(msg) {					alert(msg.message);					if (msg.status == "true") {						location.href = "/?t={{'elearning'|encrypt}}&m={{'mytask'|encrypt}}";					}				}			});		});	});</script><table>	<tr>		<td class="left">回评</td>			<div style="float: left;margin-top: 4px;">			<label class="lab" ><input type="radio" name="review" value="1"/><span >1.0分</span></label>			<label class="lab" ><input type="radio" name="review" value="2" /><span>2.0分</span></label>			<label class="lab" ><input type="radio" name="review" value="3" /><span>3.0分</span></label>			<label class="lab" ><input type="radio" name="review" value="4" /><span>4.0分</span></label>			<label class="lab" ><input type="radio" checked name="review" value="5"/><span>5.0分</span></label>			</div>			<div id="save">提交</div>		</td>	</tr></table>PHP:public function review(){    $this->_globals();    $rs = $this->mBasic->savePost("task_logs");    if($rs)    {        $msg["status"] = "true";        $msg["message"] = "回评成功";        $logs = $this->mBasic->getRow("task_logs",array("id={$_POST['id']}"));        unset($_POST);        $_POST['fromid'] = $_SESSION["login_user"]["id"];        $_POST['toid'] = $logs['uid'];        $_POST['task_id'] = $logs['task_id'];        $_POST['flag'] = 4;        $_POST['createtime'] = date("Y-m-d H:i:s");        $record = $this->mBasic->savePost("task_records");    }    else    {        $msg["status"] = "false";        $msg["message"] = "回评失败";    }    echo json_encode($msg);    die();}
$this->mBasic->getRow()是将传过来的值插入到数据库表中

第七城市

最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台