title: Can I auto replace specific strings by returned data keys in jQuery?
body: <p>I use jQuery.ajax to get some variables/response from the server side.</p>
  
  <p>The returned data is json object like this:</p>
  
  <pre><code>data.consumer_key
  data.consumer_secret
  </code></pre>
  
  <h3>Question</h3>
  
  <p>Can I automatically replace strings found in a specific container, e.g. <code>div.returned_data</code> to replace the matching formula for the returned data automatically. </p>
  
  <p>Example:</p>
  
  <pre><code>mystring.replace( '{{consumer_key}}', data.consumer_key  );
  </code></pre>
  
  <p>However, I want it to be dynamic. Catch all data returned and replace the <code>{{data_key}}</code> automatically. Can that be done or not? I mean, without precisely telling jquery to replace <code>{{consumer_key}}</code> but <code>{{replace_anything}}</code> with <code>data.replace_anything</code>. Hope my point is clear.</p>
  
  <p>Currently this works but I need it for like 10 data keys, so I am looking for an automatic preg replace solution. any idea?</p>
  
  <pre><code>$( '#api-keys-options' ).html( $( '#api-keys-options' ).html().replace( '{{consumer_key}}', data.consumer_key ) );
  </code></pre>
  
  <p>Many thanks</p>