title: Check JSON for img tag and change src in JavaScript
body: <p>We have a custom made CRM which saves the IMG's in our database as <code>/upload/image/image.jpg</code> but we also have images that have the full url. I need a way to find out if an image starts with /upload and add our web address to the front of that image src so that the image shows up correctly and does not get a square with no image,</p>
  
  <p>We are using JSON and javascript here is the code we have so far</p>
  
  <pre><code>function loadnewsstory(e)
  {
  
      if(newsview !== true)
      {
          document.getElementById("newsarticals").style.display = "block";
          document.getElementById("activecontent").style.display = "none";
          newsview = true;
      }
  
  
      xmlhttp=new XMLHttpRequest();
      xmlhttp.open("POST","http://media.queerdio.com/mobileDevice/?uri=loadstory/"+e ,false);
      xmlhttp.send();
  
      var newsreponse = JSON.parse(xmlhttp.responseText);
      var news = newsreponse[0];
  
      document.getElementById("newsarticals").innerHTML = '&lt;h1 class="newsheader"&gt;' + news.post_title + '&lt;/h1&gt; &lt;div class="newsbody"&gt;'+news.post_content+'&lt;/div&gt;';
      window.scrollTo(0,0);
  
  }
  </code></pre>
  
  <p>The part we need to look at is <code>news.post_content</code>.</p>
  
  <p>EDIT:
  Added what the JSON looks like</p>
  
  <pre><code>"post_content":"&lt;p&gt;DR SHARON Giese is a household name in America, starring on hit medical shows Dr Oz and The Doctors and making regular appearances on CBS News, CNN and NBC.&lt;\/p&gt;\n&lt;p&gt;Dr Giese is ranked among the best in her field but, as one family discovered \"with tragic consequences\" even the best make mistakes.&lt;\/p&gt;\n&lt;center&gt;&lt;img src=\"..\/..\/..\/upload\/Health\/Dr Sharon Giese - Dr OZ - YouTube.jpg\" alt=\"Dr Oz Show - DR SHARON\" width=\"650\" height=\"488\" \/&gt;&lt;\/center&gt;\n&lt;div style=\"padding: 0; margin: -6px 0 4px 10px; text-align: left;\"&gt;A screen grab from a recent appearance on the Dr Oz show. Picture: YouTube Source: YouTube&lt;\/div&gt;\n&lt;p&gt;In June 2009, 32-year-old mother-of-two Adriana Porras underwent liposuction, a fat reduction procedure performed by Dr Giese. Ms Porras died two days later of a pulmonary embolism.&lt;\/p&gt;\n&lt;p&gt;Her husband Pablos Balzola then sued Dr Giese for negligence, claiming she did not return their frantic calls when Ms Porras showed signs of severe post-surgery complications, complaining of chest pains and shortness of breath.&lt;\/p&gt;\n&lt;p&gt;In court, pathologists testified that had she received treatment for those symptoms, her chance of survival would have been much higher.&lt;\/p&gt;\n&lt;p&gt;It was later found out that Dr Giese had not performed the procedure in a hospital but in her own home office.&lt;\/p&gt;\n&lt;p&gt;This week she finally reached a settlement with Mr Balzola, agreeing to pay US$2.3 million (AUD$2.5 million)&lt;\/p&gt;\n&lt;p&gt;The money will reportedly be split between the widower, his six-year-old daughter Maia and nine-year-old son Nicholas. Mr Balzola"
  </code></pre>
  
  <p>I have used this code for our feature_images</p>
  
  <pre><code> if(news.featured_image.substring(0, 7) !== "http://")
          {
          news.featured_image = "http://www.radiobreakout.com.au/"+news.featured_image;
          }
  </code></pre>
  
  <p>But how do I get it to look at img srcs in the post_content.</p>