javascript: hacking a string to be sent in a jQuery post (form serialization)
<p>I am using serialize() in an ajax() call. However, I only want to send some fields - more specifically, I don't want to send the content field - as this contains a lot of verbose text - and is not needed.</p>

<p>I tried using <strong>$('#elem_id').serialize()</strong></p>

<p>but that returned an empty array (yes 'elem_id' is the id of an element in the DOM and it does exist).</p>

<p>Instead, I am using $('#form_id').serialize(), which works but generates a ton of rubbish which I do not need..</p>

<p>Here is a sample string that is generated when I use serialize on the entire form:</p>

<pre><code>rating%5Bvote_value%5D=3&amp;blog_post%5Bcontent%5D=a-really-really-long-piece-of-text&amp;blog_post%5Bid%5D=1
</code></pre>

<p>I want to implement a hack, to extract the string 'blog_post%5Bcontent%5D=a-really-really-long-piece-of-text' from the string obtained from the .serialize() method, so that I don't eat up all my bandwidth.</p>

<p>Can anyone help with a JS function that will rip out 'blog_post%5Bcontent%5D=a-really-really-long-piece-of-text' and splice the string back together so that I can send the shortened string to the server?</p>

<p>Here is my attempt:</p>

<pre><code>function delete_content_param(long_str){
  var pos1 = str.indexOf("&amp;blog_post%5Bcontent%5D=");
  alert('pos1:'+ pos1);
  var pos2 = str.indexOf("&amp;",pos1);
  alert('pos2:'+ pos2);
}
</code></pre>

<p>This did not yield the result I expected (i.e. index numbers), I thought I'd better come in here and ask the javascript Gurus, before wasting (yet another) entire afternoon</p>
