php jquery ajax提交
functionsearch_buyer(email){
varcontent='email='+$(email).val();
varurl='/index.php?r=admin/ajaxBuyer';
$.ajax(
{type:"post",
url:url,
data:content,
dataType:'json',
success:function(msg){
$('#ip').val(msg['info']['ip']);
$('#log')[0].innerHTML=msg['sendlog']['list'];
}
}
)
}
publicfunctionactionAjaxBuyer(){
$result=array();
try{
if(isset($_POST['email'])&&empty($_POST['email'])){
thrownewException('Email不能为空!');
}
$email=trim($_POST['email']);
if(!preg_match("/^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/",$email)){
thrownewException('Email格式有误!');
}
$result['data']=$model->getLastBuyerInfo($email);
}catch(Exception$e){
$result['errmsg']=$e->getMessage();
}
echojson_encode($result);
}
相关推荐
88570299 2020-06-18
Rain 2020-06-25
JasonYeung 2020-06-11
sunnyJam 2020-04-03
llwang0 2020-05-06
winmeanyoung 2020-04-11
vanturman 2020-04-08
keepdoingit 2020-02-23
mmyCSDN 2020-02-10
stulen 2020-01-21
zhouyuqi 2020-01-20
zhiyuan0 2020-01-18
zhangpan 2020-01-10
nanbiebao 2020-01-10
疯狂紫萧 2020-01-08
水痕 2019-12-05
peterlee 2011-07-26
codeAB 2019-10-31