title: jquery callback html and json
body: <p>I have some jQuery which passes variables to a php file, the php file generates dynamic html content based on these variables to be passed back which I then use for updating the page. </p>
  
  <p>However I also want to return some variables also so I can then decide how and where to display the html content.</p>
  
  <p>The only way I have found so far seems a little crude and I'm sure a better way exists.</p>
  
  <p>At the moment the php file puts the generated content in a tag like so</p>
  
  <pre><code>&lt;content&gt;CONTENT HERE&lt;/content&gt;
  </code></pre>
  
  <p>Then I use another tag for the var's I also want to return.</p>
  
  <pre><code>&lt;json&gt;{"name" : "value"}&lt;/json&gt;
  </code></pre>
  
  <p>Then I have this on the ajax callback</p>
  
  <pre><code>content = $(data).find('content').html();
  json = $(data).find('json').text();
  </code></pre>