2012-02-22 78 views

回答

0

使用JSON.stringify({你的對象這裏})

0

JSON.stringify(jsonObject)會給你的JSONObject轉換成字符串。它在大多數現代瀏覽器中都可用。爲了向後兼容,您可以包括:JSON-js

0
**Check this out it will be helpful** 

//index.php 
<script type="text/javascript"> 
$(document).ready(function(){ 
var json1 = {"test1":"TEST1","test2":"TEST2","test3":"TEST3","test4":"TEST4"}; 
str = "data="+JSON.stringify(json1); 

$.get('test.php',decodeURI(str),function(html){ alert(html); },"html"); 
}); 

</script> 

//test.php 

echo $GET['data'];