I´m generating some divs in an external .js file that are essential for my website. With those divs i create a button on a blade. This button shall call the Controller Method appendright() on click. I know that normally a form ist created to send some data like shown below.
<form method="POST" class="input-group" action="" enctype="multipart/form-data">
    <input type="hidden" name="_token" id="csrf-token" value="{{ Session::token() }}"/>
    <input type="text" class="form-control col-lg-3" id="inputValue" name="inputValue" required>
    <div class="input-group-append">
      <button class="btn btn-success" type="submit" onclick="theneededMethod()">+</button>
    </div>
</form>
The Problem is that i append everything. All divs and the button are inside of ' ' marks. So trying to call the functon with {{ route('appendright()')}} or url does not work because the method is surrounded with ' ' marks as well.
$('#anchor').append('<div id="'+id+'" class="fontBoxHeading box index start">
   <div class="border defaultBorder">
      <div class="innerBox notSelected">
         <div class="text">
            <div class="textPadding">'+sitemapHome+'</div>
         </div>
      </div>
   </div>
   <form method="POST" class="input-group" action="" enctype="multipart/form-data">
      <input type="hidden" name="_token" id="csrf-token" value="{{ Session::token() }}"/>
      <div class="input-group-append">
         <button class="btn btn-success" type="submit" onclick="{{ route('appendright()')}}">+</button>
      </div>
   </form>
</div>');
Maybe I just need to exclude those ' ' marks somehow. But i don´t know how. I just wannt to call a Controller function appendright().
 
    