jQuery 使用ajax,并刷新页面

<script>
        function del_product_information(id) {
            $.ajax({
                url: "{% url 'del_product_information' %}",   //请求的URL
                type: "GET",            //请求的方式
                dataType: 'json',     // 前后端交互的数据格式
                data: {'product_id': id}, //向后端发送的数据
                async: false,           //是否异步
                success: function (msg) {   //请求成功后执行的操作
                    alert(msg);
                    window.location.reload()  //刷新页面
                }
            })
        }
    </script>

 如果是提交表单时,可以通过$('#update_form').serialize(),直接打包提交。

参考链接:https://www.cnblogs.com/xshan/p/10147694.html

原文地址:https://www.cnblogs.com/mjn1/p/14539256.html