title: Change YouTube Link from watch to embed dynamically using Jquery
body: <p>How can we change List of YouTube URL(links) from <strong><a href="https://www.youtube.com/watch?v=" rel="nofollow noreferrer">https://www.youtube.com/watch?v=</a>....</strong> to <strong><a href="https://www.youtube.com/embed?v=" rel="nofollow noreferrer">https://www.youtube.com/embed?v=</a>....</strong>  dynamically in Jquery , I am new in html with jquery,please advice me in code. </p>
  
  <p><strong>my js page:</strong></p>
  
  <pre><code>function vidgallerylist(){
      var url=path+"/customer/video";
  
      $.ajax({
          type: "GET",
          url: url,
          success: function(result) {
              console.log(result);
              for(var i=0;i&lt;result.data.length;i++){
                  $('#vidlistshow').html(function(i,url){
                      var url = result.data[i].vidgalleryUrl;
                      var id = url.split('watch?v=')[2];
  
                      $("#tablevidgalleryid").append('&lt;tr&gt;&lt;td&gt;'+result.data[i].vidgalleryTitle+'&lt;/td&gt;&lt;td&gt;&lt;iframe width="380" height="258" src="http://www.youtube.com/embed/' + id + '" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;/td&gt;&lt;/tr&gt;');
  
                  });
              }
              $('#tablevidgalleryid').DataTable();
          }
      }); 
  }
  </code></pre>
  
  <p><strong>html page :</strong> </p>
  
  <pre><code>    &lt;h2&gt;List of Video Gallery&lt;/h2&gt;        
      &lt;table class="table " id="tablevidgalleryid"&gt;
          &lt;thead&gt;
              &lt;tr&gt;
                  &lt;th&gt;Title&lt;/th&gt;
                  &lt;th&gt;Videos url&lt;/th&gt;
              &lt;/tr&gt;
          &lt;/thead&gt;
          &lt;tbody id="vidlistshow"&gt;
          &lt;/tbody&gt;
      &lt;/table&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>In My Browser Page Shown like below :</strong></p>
  
  <p><a href="https://i.stack.imgur.com/fLcJ0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fLcJ0.png" alt="I want List of Video in this Page dynamically (See Image)"></a></p>