feedback.page.js
781 Bytes
/**
* 个人中心--意见反馈
* @author: Lixia Zhang<lixia.zhang@yoho.cn>
* @date: 2016/07/20
*/
var $ = require('yoho-jquery'),
tip = require('../common/tip');
var submitButton = $('#submit-button');
submitButton.on('click', function() {
var suggestText = $('#suggest-textarea').val(),
textReg = /\S+/;
if (!textReg.test(suggestText)) {
tip('意见不能为空');
return;
}
$.ajax({
type: 'post',
url: '/home/save-feedback',
data: {
content: suggestText,
}
}).then(function(data) {
if (data.code === 200) {
tip('提交成功');
} else {
tip('提交失败~');
}
}).fail(function() {
tip('网络错误~');
});
});