السلام عليكم

أطور كود صغير يقوم باستبدال روابط الصفحة ، وهو على الشكل التالي

HTML

<div class="section">
<div class="title" style="height: 22px;">title 1 </div>
<a class="link" href='

link1 title 2

JS

$('.section')
.each(function () {
    var htmlString = "";
    var $this = $(this);
    var link = $(this)
        .attr("href");
    var text = $('.title')
        .text();
    var id = link.split("/");
    document.getElementsByClassName("vidfeed")
        .innerHTML = id[4];
    $('.link')
        .attr('href', "

https://ar.exmple.com/post?n= " + id + "&b=" + text); });

المعاينة :
https://jsfiddle.net/asfarm...

لكن لم يعمل بالشكل المطلوب ما أريد الوصول له هو استبدال الرابط الى مثل هذا الشكل

https://ar.exmple.com/post?n= dddddddd&b=title 1

@zakariamouhid‍