I have an index.blade.php file. In which I am getting product information with eloquent and showing with a foreach loop. and now I want to refresh the content without including another file. I just want to load the index code with specifying id (#content).
User.php
public function product()
{
return $this->hasMany(Product::class);
}
index.blade.php
<button id='bt1'>update</button>
<div id='content'>
@foreach(auth()->user()->product as $product)
<div>$product->name</div>
@endforeach
</div>
<script>
$('#content').load('/index.blade.php #content');
</script>
I want to check there is any product added or not. Without refreshing a page.
from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2F91Lbl
via IFTTT
Aucun commentaire:
Enregistrer un commentaire