jquery ajax不在内容占位符中工作 [英] jquery ajax is not working in content place holder

查看:123
本文介绍了jquery ajax不在内容占位符中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上我曾经在滚动时从服务器上检索数据..

i使用下面的ajax代码





actually i used to retrive the data from server on scroll..
i used the below ajax code


// JScript File
 
$(document).ready(function () {
    $contentLoadTriggered = false;
    $("#mainDiv").scroll(function () {
        if ($("#mainDiv").scrollTop() >= ($("#wrapperDiv").height() - $("#mainDiv").height()) && $contentLoadTriggered == false) 
        {
            $contentLoadTriggered = true;
            $.ajax(
            {
                type: "POST",
                url: "LoadOnScroll.aspx/GetDataFromServer",
                data: "{}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                async: true,
                cache: false,
                success: function (msg) {
                $("#wrapperDiv").append(msg.d);
                $contentLoadTriggered = false;
                },
                error: function (x, e) {
                alert("The call to the server side failed. " + x.responseText);
                }
            });
        }
    });
});





如果我们在html表格中使用上述代码 $(# wrapperDiv)。append(msg.d); 工作正常

如果在母版页内的内容占位符中执行相同的代码 $( #wrapperDiv)。append(msg.d); 无效.....



i用于打印参数 msg.d 两种情况 msg.d 是一样的



请帮帮我。



if we use the above code in the html form $("#wrapperDiv").append(msg.d); is working fine
if the same code is executing in content placeholder inside a master page $("#wrapperDiv").append(msg.d); is not working .....

i used to print the argument msg.d for both the cases msg.d is the same

Please help me .

推荐答案

document )。ready( function (){
(document).ready(function () {


contentLoadTriggered = false ;
contentLoadTriggered = false;


#mainDiv)。scroll(功能(){
if
("#mainDiv").scroll(function () { if (


这篇关于jquery ajax不在内容占位符中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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