title: ajax call on hyperlink and hashbang
body: <p>I try to  use ajax calls in my pagination on hyperlink click, but fails if I use the following method</p>
  
  <pre><code>$('a#page').on('click',function(event){      
      var page = $(this).data('id');     
      //here I generate my own url
      window.location.hash = buildURI('start', page);
      search_products();
  
  });
  </code></pre>
  
  <p>the first click is getting executed and the second fails with the following error in firebug</p>
  
  <pre><code>syntax error
  this.href=
  </code></pre>
  
  <p>BuilURI method</p>
  
  <pre><code>//Method to build hashbang
  function buildURI(facet, values) {
      var uri_params = ['price', 'display', 'ram', 'hdd', 'brands', 'model', 'cpu', 'category','start','search_selection','order'];
      //console.log(values);
      var url = getUrlVars();   
      if (facet === 'brands') {
          get_models(values);
      }
  
      if(values.legth === -1){
          delete url.facet;
      }
  
      if (window.location.hash+'!') {
          var hash = window.location.hash;
          if(facet === "brands"){
              if(url.model){
                  delete url.model;
              }
          }
  
      if(facet != "start"){
              if(url.start){
                  delete url.start;
              }
          }        
          //check hashabng against parameters
          $.each(uri_params, function(index, param) {
              $.map(url, function(value, key) {
                  if (key === facet) {
                      url[key] = values;
                  }
              });
          });
  
          var uri = '#!' + decodeURIComponent($.param(url, true));
          //if facet do not match with the hashbang string we append a new one
          if (!hash.match(new RegExp('!' + facet + '(.*)|&amp;' + facet + '(.*)'))) {
              uri += "&amp;" + facet + "=" + values;
          }
      } else {
          uri += '#!' + facet + "=" + values;
      }
  
      return uri;
  }
  </code></pre>