AngularJS http sending post request fails

后端 未结 2 1741
广开言路
广开言路 2021-01-26 05:30

Having this GET request, it works (sends request to the sever and server is able to handle it):

    /* post to server*/
    $http.get(\"/forms/FormValidator1/val         


        
相关标签:
2条回答
  • 2021-01-26 05:37

    I've came up with an answer related to playframework, which fixes my/this issue.

    Here it is: Playframework handling post request

    See UPDATE 2 section there.

    The point is:

    1. On Angualar side: No need to use params at all while building url. Just general approach with data
    2. And on server side use Play' bodyParser to extract data, whatever was passed as a body of request.
    0 讨论(0)
  • 2021-01-26 05:55

    The server configuration accepts POST requests on URLs of the form: /forms/FormValidator1/validateForm/:jsonForm.

    The URL the client is POSTing to is/forms/FormValidator1/validateForm/, which does not fit that form (note the missing :jsonForm).

    0 讨论(0)
提交回复
热议问题