使用jquery刷新特定的div [英] refreshing particular div using jquery

查看:94
本文介绍了使用jquery刷新特定的div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在得到回应后,我想用ajax调用来刷新特定的div标签。

$ b

After I got response i want to refresh particular div tag using ajax call

<script>
    $(document).ready(function() {

        $('#add-new-department').submit(function(event) {
            var departmentname = $('#departmentname').val();


            $.ajax({
                url : $("#add-new-department").attr("action"),
                type : "POST",
                data : "departmentname="+departmentname,

                success : function(response) {
                    $('#status').html(response);
                    $('#departmentname').val('');
                    $('#department').load("");   
                }
            });

            event.preventDefault();
        });

    });
</script>

我想在jsp页面中更新消息

I want to update a message in jsp page

 <div id="department">Department Updated : <% new Date(); %> </div>

在ajax调用
后,我的要求是刚更新 div标记像

My requirement is just refresh div tag after ajax call like

 $('#department').refresh(); 


推荐答案

$.ajax({
  url : $("#add-new-department").attr("action"),
  type : "POST",
  data : "departmentname="+departmentname,

  success : function(response) {
     $('#status').html(response);
     $('#departmentname').val('');
     $('#department').html('Department Updated: ' + new Date());   
  }
});

这篇关于使用jquery刷新特定的div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆