jQuery showing div and then Disappearing

后端 未结 3 1465
感情败类
感情败类 2021-01-12 11:10

I apologize ahead of time if this is a simple question, I have this javascript code:

$(document).ready(function() {
    $(\"#results\").hide();

    var html         


        
3条回答
  •  太阳男子
    2021-01-12 11:42

    Have your results initially set to be hidden via CSS

    /* CSS */
    #results {
      display: none;
    }
    

    Not sure why you are jumping around the way you should use $.ajax. Use $.get if it's a GET request... Bind with .live because its better :). Let it be async because you don't want your server hanging in case of an error...

    $(document).ready(function() {
      $('#submit').live('click', function(){
        $.get('ajax.php?db_list=get', function(data){
          $('#results').html(data);
          $('#results').show();
          return false;
        });
      });
    });
    

提交回复
热议问题