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) {
        .fail(function() {
            console.log( "error" );

and the route is


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.