jQuery load reloading content in div via form submit in div

后端 未结 2 1930
有刺的猬
有刺的猬 2021-01-27 15:40

I\'m working on a messaging system. I have finished the inbox and message viewing parts. They are loaded in a div on the user account page and it all works with out refreshing t

2条回答
  •  滥情空心
    2021-01-27 16:27

    I guess it will help you:

    function submit()
    {
     $.ajax({
          type:'POST',
          url: "your url to submit",
          data: ({param_1:somevar}),    
          dataType:"json",  
          beforeSend: function(){ //do something here }
              success: function(return){ //do something here }
     });
    }
    

    And don't put any submit button. You can call the submit function with:

    $('#button').click(function(){
            submit(somevalue);  
          });
    

提交回复
热议问题