JamyWong
    $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(\'路由是可以使用的\');
});

 

分类:

技术点:

相关文章:

  • 2021-11-23
  • 2021-07-27
  • 2022-12-23
  • 2021-07-04
  • 2022-12-23
  • 2021-12-07
  • 2021-11-20
猜你喜欢
  • 2021-10-31
  • 2022-12-23
  • 2021-12-06
  • 2021-12-06
  • 2021-08-02
  • 2022-12-23
  • 2021-12-28
相关资源
相似解决方案