How to read get request using Javascript?

后端 未结 5 771
孤城傲影
孤城傲影 2021-01-06 00:49

So I have html page called A.html it was called like this from B.html : A.html?varString=\"bla-bla-bla\" Is it correct for sending ar

5条回答
  •  灰色年华
    2021-01-06 01:16

    Here is a function to parse the query string. Pass it the parameter name and it returns the value.

    function getQueryVariable(variable)
    { 
      var query = window.location.search.substring(1); 
      var vars = query.split("&"); 
      for (var i=0;i

提交回复
热议问题