Skip to content

Instantly share code, notes, and snippets.

@eastack
Created August 5, 2019 07:16
Show Gist options
  • Save eastack/fcff3af5f928b7d1993e32b207883264 to your computer and use it in GitHub Desktop.
Save eastack/fcff3af5f928b7d1993e32b207883264 to your computer and use it in GitHub Desktop.
Oh my meizu
function() {
if (!lock) {
return false;
}
lock = false;
setTimeout(function() {
lock = true;
}, 1500);
var sn = $('input[name=sn]').val();
var imei = $('input[name=imei]').val();
var is_phone = $('select[name=is_phone]').val();
if (sn) {
if (is_phone == 1 && !imei) {
$('input[name=imei]').parent().addClass('error');
return false;
}
//var url = 'http://cs-api.meizu.com/sn/verify_sn_imei?sn='+sn+'&imei='+imei+'&is_phone='+is_phone+'&callback=?';
//var url = '//mwx-api.meizu.com/sn/verify?sn='+sn+'&imei='+imei+'&is_phone='+is_phone+'&callback=?';
$.ajax({
url: '//mwx-api.meizu.com/sn/verify',
type: 'get',
data: {
"sn": sn,
"imei": imei,
"is_phone": is_phone
},
dataType: 'jsonp',
success: function(json) {
$('.result').removeClass('show');
switch (json.status) {
case 200:
if (json.data.queried == false) {
$('.result-first').addClass('show');
} else if (json.data.queried == true) {
$('.result-truly').addClass('show');
}
break;
case 10106:
$('.result-notmatch').addClass('show');
break;
case 10105:
$('.result-false').addClass('show');
break;
}
}
});
} else {
$('input[name=sn]').parent().addClass('error');
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment