首页 > 代码库 > jsonp

jsonp

function from_reg_phone(user_id,phone){
  var mehtod = "<?=base64_encode("reg_phone")?>";
  var j = "mehtod="+mehtod+"&user_id="+user_id+"&phone="+phone;
  $.ajax({
        type: ‘GET‘,  //这里用GET
    url: ‘<?=Yii::$app->params[‘hosts‘]."/index.php?r=verify/phonemsg"?>‘,
        dataType: ‘jsonp‘,  //类型
        data: j,
        jsonp: ‘callback‘, //jsonp回调参数,必需
        async: false,
        success: function(result) {//返回的json数据
      if(result.re == "success"){
        ye_msg.open(result.msg,2,1);
         window.location.reload();
      }else if(result.re == "fail"){
        ye_msg.open(result.msg,2,2);
      }else if(result.re == "error_phone"){
        ye_msg.open(result.msg,2,2);
      }else if(result.re == "protect_null"){
        ye_msg.open(result.msg,2,2);
    }
     },
     timeout: 3000
});
  from_reg_phone = clickTwo;
  return false;
}

jsonp