JSON file extract is from the url

0 votes
asked Jan 12 by abraham foto

with this function, iam able to get the data from PHP page into JS. now my route has an id as parameter. iam trying to get data id. this is my js file.

$( document ).ready(function() {

    var values = $.getJSON("/json/1");

        values.done(function(data) {
            console.log(data);
        })
        .fail(function() {
            console.log( "error" );
        });

and the route is

Route::get('json/{notification_id}','ChartController@speedHistory')->name('speedhistory')

in the var values = $.getJSON("/json/1"); number 1 is hard coded. how i can make it dynamic?

Please log in or register to answer this question.

...