How can I send JSON data to server

前端 未结 7 1053
旧巷少年郎
旧巷少年郎 2021-01-04 00:25

Well, here is the story:

I have some data need to send to server, but they should turned into JSON dataType first.

I made such ajax call:

            


        
7条回答
  •  南方客
    南方客 (楼主)
    2021-01-04 01:06

    I agree the data must be converted into a JSON string, not only to agree with the dataType and contentType setup but more importantly, to satisfy the server.

    data: JSON.stringify(data),
    dataType:'json'
    

提交回复
热议问题