Iraklis Iraklis - 7 months ago 42
HTML Question

Append blade file to jquery function

IS there any way to achieve this:

$('#appends').append('<div class="content-section" id="services">' +
" @include('') " +
' </div>');

What i want is to append the content of
is not a php url or something. It is just some lines of html where i am including in my main page.

this is the file

<div class="container">
<div class="row">
<div class="heading-section col-md-12 text-center">
<h2>Our Services</h2>
<p>We design mobile-first websites for you</p>
</div> <!-- /.heading-section -->
</div> <!-- /.row -->
<div class="row">
@foreach($data['services'] as $service)
... bla bla
</div> <!-- /.row -->
</div> <!-- /.container -->


As your question says, you want to get the content of the file and append it to the specific element.

Use $.get()

$.get("visitor.pages.service.html", function(data){

OR .load()

$('#appends').append( $('<div>').load('visitor.pages.service.html'));

OR .ajax()

    url: "your.html",
    success: function (data) { $('#appends').append(data); },
    dataType: 'html'