0

I'd like to post the order of my thumbnails to a text file as an array to be read and echoed by some PHP later. The current file() function in PHP looks for a character return to signal each array entry.

jQuery:

var order = $('#thumbList').sortable('toArray');

PHP:

$order=file('order.txt');
 foreach ($order as $value) {
    echo "<img src='gal/img/sml/$value' />";
}

I'm wondering what the best way would be to go about saving and reading an array between jQuery and PHP so that I wouldn't have to reformat the array for each language.

1
  • The current array returned by the .sortable() function looks something like: ["image_1.jpg","image_2.jpg","image_3.jpg"] Commented Nov 6, 2010 at 10:48

1 Answer 1

1

Could you serialize it to JSON? PHP and Javascript (JS only with an additional library) are both able to handle it.

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

Comments

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.