How to decode and encode a multidimensional array in javascript and php
I need to encode a three dimensional array in javascript, send it to a php script and decode it there. The Problem is, javascript outputs array, just as one sequence of integers, you can't see the dimensions. I tried to convert the ar开发者_如何转开发ray to json but couldn't find figure out how to do it.
Thanks for your help
If you're making an ajax call, say using $.post, jQuery will automatically encode the data before it hits the PHP script you called. The size, scope, and complexity of the object doesn't matter.
Find a way to serialize the array - JSON or something similar. It provides a format to convert objects and arrays to plain text and vice versa.
精彩评论