title: How to get Soundcloud embed code by soundcloud.com url
body: <p>I have been researching for hours with no luck to get it worked. Basically I have a cms in which users can put soundcloud url like this "<a href="https://soundcloud.com/cade-turner/cade-turner-symphony-of-light" rel="noreferrer">https://soundcloud.com/cade-turner/cade-turner-symphony-of-light</a>", then the page can show an embedded iframe. I have red the api docs for a while but couldn't find anything relavant. This post <a href="https://stackoverflow.com/questions/9653744/how-to-get-proper-soundcloud-url-for-embedding-from-a-standard-url">here</a> have talked but i just didn't quite understand the answers and I checked <a href="http://developers.soundcloud.com/docs/oembed#" rel="noreferrer">oEmbed</a> and <a href="http://oembed.com/" rel="noreferrer">oEmbed reference</a> but couldn't find proper example. Any one has any more hints?</p>
  
  <p>Edit:
  Thanks to Jacob's answer, I finally managed to do it by using ajax. </p>
  
  <pre><code>var trackUrl = 'THE_URL';
  var Client_ID = 'CLIENT_ID';//you have to register in soundcound developer first in order to get this id 
  $.get(//make an ajax request
      'http://api.soundcloud.com/resolve.json?url=' + trackUrl + '&amp;client_id=' + Client_ID, 
      function (result) {//returns json, we only need id in this case
          $(".videowrapper, .exhibitions-image, iframe").replaceWith('&lt;iframe width="100%" height="100%" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/' + result.id +'&amp;amp;color=ff6600&amp;amp;auto_play=false&amp;amp;show_artwork=true"&gt;&lt;/iframe&gt;');//the iframe is copied from soundcloud embed codes
      }
  );
  </code></pre>