title: Uncaught TypeError: Cannot read property 'substring'
body: <p>I´m getting this strace error </p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'substring' of undefined</p>
  </blockquote>
  
  <p>This is what i want </p>
  
  <p><a href="http://localhost:3001/product/?id=5" rel="nofollow noreferrer">http://localhost:3001/product/?id=5</a></p>
  
  <p>Get the value of "5"</p>
  
  <p>I´m using this code in Javascript</p>
  
  <pre><code>    var id = url.substring(url.lastIndexOf('?=') + 1);
  
      var url = "http://localhost:3000/product/"+id;
        console.log(url);
      $.ajax({
            url:url,
  
  .........
  });
  </code></pre>
  
  <p>?id=5:161 Uncaught TypeError: Cannot read property 'substring' of undefined</p>