Pass through ‘&parameter’ in a URL

I’m working on a project which passes a variable into a iFrame with this code:

jQuery(function() {
    var search = window.location.search;
    jQuery(".iframe-wrapper").attr("src", jQuery(".iframe-wrapper").attr("src")+search);
});

But, when I pass through &section=P1 in a URL, it just gives a 404.

Read More

Source of the iFrame: example.com/page?cart=1

After going to site.com/&section=P1 the iFrame should change to example.com/page?cart=1&section=P1

Anyway to pass through the &section=P1 through the URL?

Related posts

Leave a Reply

1 comment

  1. Please send your HTML as mine is working fine with the below:

      <iframe width="500" height="200" class="iframe-wrapper" src="http://www.google.com?param=1"></iframe>
        <script type="text/javascript">
         $(function() {
        var search = window.location.search;
        search = search.replace("?","&");
    
        $(".iframe-wrapper").attr("src", $(".iframe-wrapper").attr("src")+search);
        });
        </script>