/**
* Display a listing of the resource.
*
* @param IlluminateHttpRequest $request
* @return Response
*/
public function index(Request $request)
{
if($request->ajax()){
return "AJAX";
}
return "HTTP";
}
$(document).ready(function() {
$('#country').change(function () {
var country_id = this.value;
$.ajax({
url: '{{url('/')}}/admin/lottery_master/getstatesbycountry/'+country_id,
dataType: 'json',
type: 'GET',
error: function() {
toastr.error('Server error occured', Error, {
CloseButton: true,
ProgressBar: true
});
},
success: function(data) {
var sel = $("#state");
var stateList = data.state;
sel.empty();
sel.append('<option value="">-- Select State --</option>');
for (var i=0; i<stateList.length; i++) {
sel.append('<option value="' + stateList[i].id + '">' + stateList[i].state_name + '</option>');
}
},
});
});
});
if($request->ajax()){
return "ajax request";
}