var E = window.wangEditor var editor = new E('#editor') editor.create() $(".pushArticel").click(function() { var title = $(".title").val() var introduction = $(".introduction").val() var author = $(".author").val() var content = editor.txt.html() // 验证用户是否输入内容,有没填写的给提示 // 对push接口实现token验证的调用, // 登录成功本地保存 token,发送ajax请求头携带token // $.ajax({ url: 'http://127.0.0.1:3000/admin/api/push', type: 'POST', data: { title: title, introduction: introduction, author: author, content: content }, success: function(res) { console.log(res); }, error: function(err) {} }) });