Convert js Array() to JSon object for use with JQuery .ajax

后端 未结 5 1572
慢半拍i
慢半拍i 2020-11-28 10:13

in my app i need to send an javascript Array object to php script via ajax post. Something like this:

var saveData = Array();
saveData[\"a\"] = 2;
saveData[\         


        
5条回答
  •  一整个雨季
    2020-11-28 10:15

    When using the data on the server, your characters can reach with the addition of slashes eg if string = {"hello"} comes as string = {\ "hello \"} to solve the following function can be used later to use json decode.

    
    

提交回复
热议问题