title: How can I put all the URL parameters in array of objects using jQuery?
body: <p>I have a giving string/url like this
  <code>https://example.com/loadcontent?var1=100&amp;var2=:somevar&amp;var3=:morevariables</code></p>
  
  <p>I need to loop thought each parameter in the url. If the value starts with <code>:</code> this indicated that it is a variable an I will need to change that value dynamically by looking at the corresponding meta attribute that matches that variable. </p>
  
  <p>Here is my code in which loops over an array and sets the value of the parameters.</p>
  
  <pre><code>    var baseURL = getBaseURL(url);
  
      var params = getParams(url);
      var newParams = $.each(params, function(index, param){
  
         if( param.value.substring(0, 1) == ':'){
             var myVar = param.value.substring(1);
             param.value = $('meta[name=" + myVar + "']).attr('value');
         }
  
      });
  
      var finalURL = baseURL + '?' + jQuery.param( newParams );
  
  function getParams(url){
    // This function should return an array of objects. Each object should have 2 properties "value" and "name". The "name" property should be the name of the parameter (ie. var1, var2, var3 .....) and the "value" attribute should contains the value of the parameter (ie. 100, :somevar, :morevariables)
  
  
  }
  
  function getBaseURL(url){
  
    var cutoff = url.indexOf('?');
  
    if( cutoff &gt; -1){
       return url.substring(0, cutoff - 1);
    }
  
    return url;
  
  }
  </code></pre>
  
  <p>I need help converting the parameters of a giving URL to array of object. How can I do this in jQuery?</p>