开发者

jQuery Ajax function getJSON() is not getting called

开发者 https://www.devze.com 2023-01-27 06:03 出处:网络
I have the following code: <script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js\"></script>

I have the following code:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
     $(document).ready(function(){
     $('#property').keyup(function() {
          var query = $(this).val();
      $('#results').html(query);
              $.getJSON('InstantSearchServlet?property=' + query, null, callBackProperty);
              }
      });    
});

For some reason the InstantSearchServlet is never getting called but when I directly call the se开发者_如何学Pythonrvlet by editing the url to /InstantSearchServlet?property=e for example I get the desired result. I have tried putting a / before InstantSearchServlet... and that doesn't change anything.

Thanks.


Instead of .val(), try .html() or .text()

0

精彩评论

暂无评论...
验证码 换一张
取 消