js:
$.ajax({
dataType:"json",url:"/index.php?m=Callup&a="+callup_operating+"&ts=do_post",
type:"POST",
data:$("form").serialize(),
dataType:'json',
success:function(data, st){
}
});
var data=$("form").serialize();
$.get("{:U('market/ajax_user_addressP')}",data, function(data) {
if(data.code==1){
$('.user-addr-tips').show();
}else{
alert(data.message);
}
}, 'jsonp');
php:
$data = filterstr($_REQUEST);
common:
/**
* 数据过滤
* @param array $data
* @return array
*/
function filterstr($data){
if(!empty($data)) {
foreach($data as $_key => $_value) {
if(!is_array($_value)){
$_value = urldecode($_value);
$_value = strip_tags($_value);
$_value = trim($_value);
$data[$_key] = addslashes($_value);
}
else{
$data[$_key] = filterstr($_value);
}
}
}
return $data;
}