Revert JSON on php script
I have JSON -
{"First name": "Jo开发者_开发百科hn", "Contact": "2323",...}
with arbitrary number of key/value pairs. My $.ajax
-function sends JSON to a php script. The PHP script must revert JSON and back to jQuery.
{"John": "First name", "2323": "Contact",...}
PHP code for this iteration and jQuery handling code for response?
PHP json_decode() then array_reverse and json_encode()
In jQuery get data by .ajax with dataType: 'json' and array will be ready to use.
I think that application logic shouldn't rely on array elements order
精彩评论