How to refresh page using jquery

Refresh whole page

// Binding Button Click Event when Page Loading
$(function ($){
    $("# button id").click (function ()){
        Refresh ();
// the method to be nvokee when Click on the button 
Function refresh (){
    Window.location.reload();//refresh the current page.
    // parent.location.reload (); // refreshes father objects (for frameworks) - to be used within the iframe framework
    // opener.location.reload (); // refreshes the parent window object (for single windows)
    // top.location.reload (); // refreshes the top-most object (for multiple windows)

Using jQuery's load method to implement partial refresh of div

Traditional practices

Use traditional method,we need to write lots of html codes to  redraw that part of the DIV
var content = document.getElementById ("content");
content. innerHTML ("HTML code")

And if we use jQuery's load method, We can do it more concisely.

Use JQuery's load () method


<div id="content">
    <div class="table-responsive">
        <!-- do something-->


    async: false,
    type: "POST",
    url: '/admin/user/deleteMore',
    data: {"ids":ids},
    dataType: "json",
    success: function () { },
    error: function () { },
    complete: function () {
        $("#content").load("http://localhost/admin/user/list .table-responsive");
date2019-04-17 15:56:36 Author:JPH
Related Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *