controlardor
Código:
en la vistaif($request->ajax()) { $fecha_nac = new DateTime(date('Y-m-d',strtotime($fecha))); $fecha_hoy = new DateTime(date('Y-m-d',time())); $edad = date_diff($fecha_hoy,$fecha_nac); return response()->json($edad); }
Código:
$("#inputfecnac").change(function(event){ $("inputfecnac").empty(); fecha=$("#inputfecnac").val(); $.get("fecha/"+fecha+"",function(data){ $('#edad').html(data); console.log($data); }); });