|
function search_buyer(email){
var content = 'email='+$(email).val();
var url = '/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'];
}
}
)
}
public function actionAjaxBuyer(){
$result=array();
try{
if(isset($_POST['email']) && empty($_POST['email'])){
throw new Exception('Email 不能为空!');
}
$email= trim($_POST['email']);
if ( !preg_match("/^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/", $email)) {
throw new Exception('Email 格式有误!');
}
$result['data']=$model->getLastBuyerInfo($email);
}catch (Exception $e){
$result['errmsg']=$e->getMessage();
}
echo json_encode($result);
} |
|
|