How to update database with jQuery without refreshing the page?

前端 未结 2 1003
北海茫月
北海茫月 2021-01-28 02:38

How do I send this display_false() function to the server with jQuery so that the database is updated without refreshing the page?

    def display_f         


        
2条回答
  •  一个人的身影
    2021-01-28 03:31

    You'll need an AJAX call, something like this after including your jQuery libraries.

    $(document).ready(function() {
    
    //false click action
    $("a.false").click(function () { 
    
    //ajax server call
    $.ajax({
      url: '/useradminpage?main_id=%s&display=false',
      success: function(data) {
        //do some stuff.
        alert('returned');
      }
    });
    
    });
    
    
    
    });
    

提交回复
热议问题