我想在单击一个按钮后重新加载div.我不想重新加载整个页面.

Here is my code:

HTML:

<div role="button" class="marginTop50 marginBottom">
    <input type="button" id="getCameraSerialNumbers" value="Capture Again" class="disabled" />
    <input type="button" id="confirmNext"  value="Confirm & Proceed" class="disabled marginLeft50" />
</div>

点击<input type="button" id="getCameraSerialNumbers" value="Capture Again">按钮后,<div id="list">....</div>将重新加载,而无需加载或刷新整个页面.

Below is the Jquery which I tried, but not working:-

$("#getCameraSerialNumbers").click(function () {
    $("#step1Content").load();
});

请建议.

这是我页面上的DIV,其中包含一些产品的图片和序列号…它将在页面加载时第一次来自数据库.但是如果用户面临一些问题,他将单击"再次捕获"按钮"<input type="button" id="getCameraSerialNumbers" value="Capture Again">",这将再次加载这些信息.

Div的HTML代码:-

<div id="step1Content" role="Step1ShowCameraCaptures" class="marginLeft">

<form>
    <h1>Camera Configuration</h1>
    <!-- Step 1.1 - Image Captures Confirmation-->
    <div id="list">
        <div>
            <p>
                <a id="pickheadImageLightBox" data-lightbox="image-1" title="" href="">
                    <img alt="" id="pickheadImage" src="" width="250" height="200" />
                </a>
            </p>
            <p>
                <strong>Pickhead Camera Serial No:</strong><br />
                <span id="pickheadImageDetails"></span>
            </p>
        </div>
        <div>
            <p>
                <a id="processingStationSideImageLightBox" data-lightbox="image-1" title="" href="">
                    <img alt="" id="processingStationSideImage" src="" width="250" height="200" />
                </a>
            </p>
            <p>
                <strong>Processing Station Top Camera Serial No:</strong><br />
                <span id="processingStationSideImageDetails"></span>
            </p>
        </div>
        <div>
            <p>
                <a id="processingStationTopImageLightBox" data-lightbox="image-1" title="" href="">
                    <img alt="" id="processingStationTopImage" src="" width="250" height="200" />
                </a>
            </p>
            <p>
                <strong>Processing Station Side Camera Serial No:</strong><br />
                <span id="processingStationTopImageDetails"></span>
            </p>
        </div>
        <div>
            <p>
                <a id="cardScanImageLightBox" data-lightbox="image-1" title="" href="">
                    <img alt="" id="cardScanImage" src="" width="250" height="200" />
                </a>
            </p>
            <p>
                <strong>Card Scan Camera Serial No:</strong><br />
                <span id="cardScanImageDetails"></span>
            </p>

        </div>
    </div>
    <div class="clearall"></div>

    <div class="marginTop50">
        <p><input type="radio" name="radio1" id="optionYes" />Yes, the infomation captured is correct.</p>
        <p><input type="radio" name="radio1" id="optionNo" />No, Please capture again.</p>
    </div>
    <div role="button" class="marginTop50 marginBottom">
        <input type="button" id="getCameraSerialNumbers" value="Capture Again" class="disabled" />
        <input type="button" id="confirmNext"  value="Confirm & Proceed" class="disabled marginLeft50" />
    </div>
</form>

Now on click of <input type="button" id="getCameraSerialNumbers" value="Capture Again" class="disabled" /> button, the information which is in <div id="list">... </div> should be loaded again.

Please let me know if you need some more information.

推荐答案

I always use this, works perfect.

$(document).ready(function(){
        $(function(){
        $('#ideal_form').submit(function(e){
                e.preventDefault();
                var form = $(this);
                var post_url = form.attr('action');
                var post_data = form.serialize();
                $('#loader3', form).html('<img src="../../images/ajax-loader.gif" />       Please wait...');
                $.ajax({
                    type: 'POST',
                    url: post_url, 
                    data: post_data,
                    success: function(msg) {
                        $(form).fadeOut(800, function(){
                            form.html(msg).fadeIn().delay(2000);

                        });
                    }
                });
            });
        });
         });

Jquery相关问答推荐

逐个交换图像

Bootstrap 3模态框和video.js视频未正确调整大小

通过 .push() 方法向对象添加项目

foreach for JSON 数组,语法

在 Bootstrap 3 中向工具提示添加换行符

组合数组时无法读取未定义的属性推送

jQuery .get 错误响应函数?

如何同时使用 requireJS 和 jQuery?

jQuery.extend 和 jQuery.fn.extend 的区别?

如何使用 jQuery 更改文本

jQuery ajax (jsonp) 忽略超时并且不触发错误事件

如何隐藏 Twitter Bootstrap 下拉菜单

从客户端的对象数组中获取最新日期的优雅方法是什么?

更改 div 的内容 - jQuery

javascript,是否有像 isArray 这样的 isObject 函数?

如何复制 pinterest.com 的绝对 div 堆叠布局

jQuery - 添加 ID 而不是类

更改 url 而不使用 javascript 重定向

Chrome 中的 AJAX 发送选项而不是 GET/POST/PUT/DELETE?

使用 jQuery 将一个标签替换为另一个标签