开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜