How to read JSON object to WebAPI

前端 未结 4 1170
走了就别回头了
走了就别回头了 2021-01-14 23:22

I\'ve checked a few similar questions, but none of the answers seem to fit (or dumb it down enough for me). So, I have a really simple WebAPI to check if user with an email

4条回答
  •  我在风中等你
    2021-01-14 23:53

    var dto = {        
        Email: "ex.ample@email.com"
    };
    
    $.ajax({
        url: "/api/User/",
        type: "GET",
        data: dto,
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (data) {
            if (data == true) {
                // notify user that email exists
            }
            else {
                // not taken
            }             
        }                      
    });
    

提交回复
热议问题