create string route in script blade laravel

I´m traying to create function with function onClick(parameter) that call one function and redirect to one route in laravel, but my problem it´s that this route have 3 parameter.

Route::get('llamadas/estadisticas/pasadas/{operator}/{fromDate},{toDate}', '[email protected]')->name('llamadas.estadisticas.pasadas');

my function it´s:

function redirectFunction(operator)
{
let fromDate = $("#fromDate").val();
let toDate = $("#toDate").val();

var yearStart = fromDate.substring(0,4);
var monthStart = fromDate.substring(5,7);
var dayStart = fromDate.substring(8,10);

var yearEnd = toDate.substring(0,4);
var monthEnd = toDate.substring(5,7);
var dayEnd = toDate.substring(8,10);

fromDate = dayStart + "-" + monthStart + "-" + yearStart;
toDate = dayEnd + "-" + monthEnd + "-" + yearEnd;

var url = "";
url = url.replace(':operator', operator);
url = url.replace(':fromDate', fromDate);
url = url.replace(':toDate', toDate);
console.log(url);
//window.location.href = url;
}

i need set this parameter in my route. I´m using url because i can´t use route, always return that parameter it´s incorrect. I know that it´s better to use Route

i need create this route for send this data to my controller that execute query and return this results to blade to generate statistics with chart.js and i need all parameter. But i cant generate nothing if i don´t send good my data.

now i´m returning this:

http://localhost:5080/gdsRepository/public/admin.llamadas.estadisticas.pasadas/%3Aoperator/%3AfromDate/%3AtoDate

if i do:

var url = "";

return this:

http://localhost:5080/gdsRepository/public/admin.llamadas.estadisticas.pasadas/%22%2Boperator%2B%22/%22%2BfromDate%2B%22/%22%2BtoDate%2B%22

anybody can help me, please??

thanks for readme and help me

from Newest questions tagged laravel-5 – Stack Overflow https://ift.tt/2YIdSqH
via IFTTT

Related Posts

Codeigniter : Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE) in Laravel project

I’m getting following error: **Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE)** Note : It’s working in local but facing issue in production server. private…

Firebase receive notification while tab is active or on focus

What i want is to be able to perform an action when a user receives a notification while the browser is open and tab is active or…

Laravel’s alias loader does not find class

We have a legacy project that we cannot update and we need to make some changes in symfony’s Response.php in vendor. We have solved this by copying…

Laravel 5 – generic document management

I have a system where you can create different types of unique documents. For instance, one document is called Project Identified and this expects certain inputs. Originally,…

Laravel Nova limit the results in indexQuery

I ran intro a situation where I need to limit the results of a resource to only 3 results. To be more specific, based on the logged…

Auditoria en laravel 5.8 [closed]

Cómo puedo automatizar el registro de actividades de un usuario en laravel? Si un usuario ingresa a un app de laravel, debo guardar toda su actividas, a…

Leave a Reply

Your email address will not be published.