Con el siguiente código HTML, creé un selector de rango de fechas y luego agregué una publicación HTTP usando javascript.
CÓDIGO:
<!DOCTYPE html> <html lang="en"> <head> <title>Fraction daterange</title> <script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/latest/jquery.min.js"></script> <script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script> <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" /> </head> <body> <input type="text" name="daterange" value="" /> <script> $(function () { $('input[name="daterange"]').daterangepicker({ opens: 'left' }, function (start, end, label) { variable_one = start.format('YYYY-MM-DD'); console.log("Hai hari its working"); console.log(variable_one); }); }); fetch("http://localhost:8000/hvals_hash?key=30-8-21") .then(response => response.json()) .then(data => console.log(data)); </script> </body> </html>A partir de este código, almacené la fecha en variable_one, URL después de pasar así http://localhost:8000/hvals_hash?key=${variable_one} después de pasar así no obtuve ninguna respuesta de la API, pero la solicitud de la API alcanzó la API rápida .
Problemas :
Cómo pasar Variable en URL con método de búsqueda
Cómo OBTENER valores del rango de fechas (EX: 13-12-2021) y llamar a la API con variable
mostrar datos en la consola después de seleccionar una fecha de un selector de fecha.
Nota: Ejemplo de URL ( http://localhost:8000/hvals_hash?key=30-8-21 )