title: WordPress change div content using post type and select box
body: <p>I'm trying to create a plugin for WordPress that creates a custom post type. A widget is also created that the user can put on the site. The widget wants to list the title of each post in a drop-down select box. When the selected title is changes, the content from the relative post wants to be populated into a div below the select box in the widget.</p>
  
  <p>I have created the post type and widget. The widget is successfully creating the drop-down menu. I am having difficulty with updating the div with the relative content. I initially tried to do this by running through the PHP post loop and add all content to an array however realised that this would be too cumbersome. I'm looking at AJAX as my best solution however I have no experience with this and have been unable to find a useful example.</p>
  
  <pre><code>&lt;select id="optionToggle"&gt;
      &lt;option value="default"&gt;Select a option&lt;/option&gt;
      &lt;option value="196"&gt;Option 1&lt;/option&gt;
      &lt;option value="197"&gt;Option 2&lt;/option&gt;
      &lt;option value="198"&gt;Option 3&lt;/option&gt;
      &lt;option value="199"&gt;Option 4&lt;/option&gt;
      &lt;option value="201"&gt;Option 5&lt;/option&gt;
  &lt;/select&gt;
  &lt;div class="content"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>The above is what I am currently constructing with the value been the post ID and Option # been the post title. I have a javascript function that listens to when #optionToggle is changed and it then grabs the value. From what I have heard, it appears that WordPress has a integrated AJAX feature that can grab the content from a given post ID without re-loading the page however I am unable to figure this out.</p>
  
  <p>Has anybody had any experience with this that may be able to help?</p>