You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
900 B
JavaScript
42 lines
900 B
JavaScript
|
|
$(function(){
|
|
$('#btn-submit').click(function(event) {
|
|
var _this = $(this);
|
|
|
|
var pay = $('#payform').find('input[name="pay"]:checked').val() || '';
|
|
if(pay == ''){
|
|
alert('Please choose an amount.');
|
|
return false;
|
|
}
|
|
|
|
var email = $('#payform').find('input#email').val();
|
|
if(email == ''){
|
|
alert('Please enter your email!');
|
|
return false;
|
|
}
|
|
|
|
$.ajax({
|
|
url:'/todo/payauthor/save',
|
|
type:'POST',
|
|
data:$('#payform').serialize(),
|
|
beforeSend:function(){
|
|
//console.log(_this);
|
|
_this.attr('disabled', true);
|
|
},
|
|
success:function(obj){
|
|
if(obj.code == 200){
|
|
$('#payinfo').html(obj.message);
|
|
//$('#payform').remove();
|
|
}else if(obj.code == 400){
|
|
$('#payinfo').html(obj.message);
|
|
}else{
|
|
alert(obj.message)
|
|
}
|
|
},
|
|
error: function() {
|
|
console.log('sorry! something wrong went out!');
|
|
}
|
|
});
|
|
return false;
|
|
});
|
|
}) |