通过ajax提交到url路由
生活随笔
收集整理的這篇文章主要介紹了
通过ajax提交到url路由
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
$regBoxform.find('button').on('click', function(){/*通過ajax提交請求*/$.ajax({type:'post', /*用post 方式提交*/url:'/user/register', /*提交到api的指定路由路徑*/dataType: 'json',data:{username: $regBoxform.find('[name="username"]').val(),password: $regBoxform.find('[name="password"]').val(),repassword: $regBoxform.find('[name="repassword"]').val()},success: function (result) {console.log(result);},
/* error: function(XMLHttpRequest, textStatus, errorThrown) {alert(XMLHttpRequest.status);alert(XMLHttpRequest.readyState);alert(textStatus);}*/});}) router.post('/user/register', function(req, res){console.log('路由是可以使用的');
});
?
轉(zhuǎn)載于:https://www.cnblogs.com/JamyWong/p/7709999.html
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎總結(jié)
以上是生活随笔為你收集整理的通过ajax提交到url路由的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ip_forward
- 下一篇: 修改节点的属性 节点默认不允许修改