php - How can I post a JSON multi-dimensional data via Jquery.post? -
How can I post a JSON multi-dimensional data by $ .post? For example, I have this multi-dimensional array in JSON format:
{"file": {"name": "1024x768.jpg", "type": "image \ / jpeg", "Tmp_name": "C: \\ wamp \\ tmp \\ php8F59.tmp", "Error": 0, "Size": 469159}} I Jquery Post () to post JSON data $ Post ("process.php", '{"name": "1024x768.jpg", "type": "image \ / jpeg", "tmp_name": "c: \\ wamp \\ tmp \\ php8F59.tmp" , "Error": 0, "size": 469159}} ', function (xml) {}); So I can get this code in process.php print_r ($ _ POST) : Array ([file] = & gt; Array ([name] = & gt; 1024x768.jpg [type] => image / jpeg [tmp_name] => c: \ wamp \ Tmp \ phpA1.tmp [error] = & gt; 0 [size] => 469159)) Is this possible?
Try it out:
$ Post ("process.php", {"file": {"name": "1024x768.jpg", "type": "image \ / jpeg", "tmp_name": "C: \\ wamp \\ tmp \\ Php8F59.tmp "," error ": 0," size ": 469159}}, function (xml) {}); You should give the desired array on the php side
EDIT: This works after jQuery 1.4 and above
Comments
Post a Comment