title: Get URL param/segments conditionally (JS/jQuery)
body: <p>I'm using an external jQuery url parsing library <a href="http://github.com/allmarkedup/jQuery-URL-Parser" rel="nofollow">http://github.com/allmarkedup/jQuery-URL-Parser</a> to grab url segments for GET. The URL's i'm working with include one of two formats:</p>
  
  <pre><code>http://example.com/#name
  or 
  http://example.com/?name=name
  </code></pre>
  
  <p>Depending on the url im getting fed back, I want to use the url parsing library to construct a string. Either the hash tag value or the value of name. I'm running into an issue that I can't really query for an empty value using this library or I haven't found out how. Or I want to be able to figure out the URL format first. If I try to query for a url segment that it can't find, my application breaks. Any hints?</p>
  
  <pre><code>using http://example.com/?name=name
  
  var url_anchor = jQuery.url.attr("anchor");
  var url_query_name = jQuery.url.param("name");
  if(url_anchor.length == 0){alert("The url anchor is: " + url_anchor)};
  </code></pre>
  
  <p>i'm expecting, obviously wrongly expecting :), the above to return NULL or Undefined but nothing happens.</p>