How can I send JSON data to server

前端 未结 7 990
旧巷少年郎
旧巷少年郎 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:01

    Try this: http://www.abeautifulsite.net/blog/2008/05/postjson-for-jquery/

    Its a lot shorter:

    $.post(url, data, function(response) {
        // Do something with the response
    }, 'json');
    

提交回复
热议问题