'Laravel AJAX create HTML DOM(tooltip) element onhover
How to create dynamically tooltip using AJAX in Laravel?
I've got table, each element of table has it own ID, stored in <div id="[numbers]" hover="tooltip(this.id);"></div>
For each element I want to "create" or display tooltip(for displaying data like name, date, etc.).
Is it possible? This is what I've got at the moment:
// blade.view
function test(id)
{
$.ajax({{
type: "GET",
data:
{
id:id,
},
url: "{{ route('box.getData') }}",
success: function(data){
alert("data");
}
}});
}
Route:
Route::get('/box', 'App\Http\Controllers\BoxController@getData')->name('box.getData');
How to proceed with that in Controller?
Added controller:
public function getData(Request $request)
{
$absence = Absence::findOrFail($request->id);
return response()->json($absence, 200);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
