jQuery: How to stop AJAX function escaping JSON string used to POST data

前端 未结 5 1340
遇见更好的自我
遇见更好的自我 2020-12-11 02:07

I need to serialize all inputs from a form into a JSON string.
With the help of this post, I can successfully create a valid string as below:

{\"input01\         


        
5条回答
  •  青春惊慌失措
    2020-12-11 02:48

    Be sure that you

    echo $_GET['varwithurl']
    

    not

    echo json_encode($_GET['varwithurl'])
    

    as many php web examples do.

    I send data with url with $.ajax() and don't see unwanted backslashes in php script.

提交回复
热议问题