Submit Search query & get Search result without refresh

前端 未结 4 1883
深忆病人
深忆病人 2020-12-25 09:45

I want to submit search query form & get search result without redirecting/reloading/refreshing on the same pa

4条回答
  •  不思量自难忘°
    2020-12-25 10:07

    This is what AJAX is for. In jQuery (apologies if you're looking for a different library)

    $("form#search").bind('submit',function() {
      $.post("search.php",this.serialize(),function(data) { 
        // Put the code to deal with the response data here
      });
      return false;
    });
    

提交回复
热议问题