2

I'm making a PHP model to store a serialized array in a database. The array is then accessed via AJAX through an HTTP request.

Is there a JavaScript function to serialize and unserialize arrays like PHP?

EDIT: This is the php function http://uk.php.net/manual/en/function.serialize.php

2

2 Answers 2

3

Sorry for the (almost an year :) ) late response, but i just saw this.

Since i can only place one link, i will give you this one: http://phpjs.org/functions/index

Search for "serialize" and "unserialize" and you'll find them. I had to send serialized data to the server, and PHP works perfectly with the results of these functions.

Be sure to also take a look at the dependencies and get those functions as well.

Best of luck!

Sign up to request clarification or add additional context in comments.

Comments

2

You meant “serialize”? jQuery’s $.ajax & $.json methods would automatically serialize JavaScript objects for you, and in modern browsers you can use JSON.stringify directly.

1 Comment

There is also a json library provided by Douglas Crockford at json.org/js.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.