搜索功能,一个文本框,一个搜索图片。
点击图片或者按回车,不文本框的内容交给后台地址。
<input id="tags" name="tags" size="50" /> 
<img alt="" id="imgid" style="cursor:pointer;" onclick="s();" src="../../Content/images/search.gif" width="118" height="33" />  <script type="text/javascript">
      function s() {
          var t = document.getElementById('tags');
          var url = '/fenlei/ajaxSearchResult/?title=' + t.value; //http://localhost:3087/fenlei/ajaxSearchResult/?title=6
          alert(url);
          window.location = url;
          alert();
      }
      $(document).ready(function() {
          $("#tags").bind("keydown", function() {
              if (window.event.keyCode == 13) {
                  s();
              }
          });
      });
  </script>
如果window.location后面有alert();就可以成功跳转页面 http://localhost:3087/fenlei/ajaxSearchResult/?title=1
如果没有,则不会跳转页面,而是在本页面增加参数 http://localhost:3087/?tags=1
请问怎么解决?