<script>
//添加tab active样式
$('a[data-active="my"]').addClass('active');
$('a[data-active="my-spacediy"]').addClass('active');
//submit
var jform = $('#form');
var jsubmit = $('#submit');
jform.on('submit', function() {
jform.reset();
jsubmit.button('loading');
var postdata = jform.serializeObject();
$.xpost(jform.attr('action'), postdata, function(code, message) {
if (code == 0) {
$.alert(message);
jsubmit.button(message).delay(3000).button('reset');
} else if (xn.is_number(code)) {
alert(message);
jsubmit.button('reset');
} else if (code == -1) {
$.alert(message);
jsubmit.button(message).delay(3000).button('reset');
} else {
jform.find('[name="' + code + '"]').alert(message).focus();
jsubmit.button('reset');
}
});
return false;
});
</script>
错误提示,
if (code == -1) {
$.alert(message);
jsubmit.button(message).delay(3000).button('reset');
}
对应:
$r === FALSE AND message(-1, lang('update_failed'));