通过路线发送参数

I'm trying to pass some parameters through the URL, i tried to do it this way but it isn't working, the "get(\users:id)" is probably the mistake but i'm not sure whats the correct way:

    $.ajax({
    type: 'GET',
    URL: "'../users/"+id+"'",
    success: function(data) {           
      console.log("success");             
    }        
    })

and then i use this route:

  app.get('/users/:id', function(req, res) {});

shouldn't this work?

Try this way:

$.ajax({ 
      type: 'GET', URL: "'../users/"+id+"'",
      success: function(data) {
                     console.log("success"); 
               }
 }):

An then the route should be:

app.get("/users/:id", function (req, res) {
   var id = req.params.id;
});

Your problem seems to be attempting to hit a file system relative path from your client, and the fact that there is no response being sent from your endpoint. Try this (using fetch which is the newer way instead of $.ajax):

fetch('/users/' + id)
   .then(function(response) {
      return response.json();
   })
   .then(function(myJson) {
      console.log(myJson);
   });

And in your server:

app.get('/users/:id', function(req, res) {
    console.log(req.params); // this should be an object containing an `id` param
    res.send({});
});