@sanainfotech ,
Your mothod can be whatever you want. Just try to be explicit.
Even Angular and Jquery can run together, for ajax request you just need to use only one.
You can use the "<select " event onclick="state()". This is not a jquery way. This will call a state function outside of jquery scope. To do jquery way you can do as you did like:
$( "#state" ).change(function()
{
//this is the #state dom element
var state = $(this).val();
// parameter 1 : url
// parameter 2: post data
//parameter 3: callback function
$.get( 'put_your_url_here' , { state : state } , function(htmlCode){ //htmlCode is the code retured from your controller
$("#domains_table tbody").html(htmlCode);
});
});
// In your controller
public function getDomains(Request $request)
{
$state = $request->state;
$domains = DB::table('domains')->where('state' ,'=', $state )->get();
$html = view('view_that_will_create_your_table_data', compact('domain'))->render();
return $html
}
//view_that_will_create_your_table_data.blade.php
@foreach( $domais as $domain)
<tr>
<td>{{ $domain->your_property }}
<td>{{ $domain->your_property }}
<td>{{ $domain->your_property }}
</tr>
@endforeach
If you want to render your default domains state in your main view you can just call view_that_will_create_your_table_data like
<table id="domains_table">
....
<tbody>
@include('view_that_will_create_your_table_data ')
</tbody>
</table>
Of couse there are other approaches, this is one of many you can implement!