What's the best way to send JavaScript array to PHP script using GET?
<p>I have an interactive web application powered by jQuery where users can manipulate visual objects on the screen. When done, the "state" of JavaScript objects should be sent to PHP to store into database. I'd prefer to use GET for this, but solution that uses POST to submit the data is also viable. </p>

<p>I'm currently thinking to serialize all JS objects using something like base64 encoding and just use something like:</p>

<pre><code>var str = encode_objects();
document.location = 'result.php?result='+str;
</code></pre>

<p>However, something tells me there has to be some, more elegant, way than writing my own base64 encoding function in JavaScript. Isn't there something already built into JavaScript that can do the job?</p>

<p><strong>Update:</strong> decoding in PHP is not the problem. I know how to decode base64, JSON, whatever in PHP. The problem is how to encode data on JavaScript side.</p>

<p>AJAX is out of the question. It has to be a clean GET or POST with page reload.</p>
