简体   繁体   English

Firefox中的AJAX回调失败

[英]AJAX callback failing in Firefox

The page contains accordion control which expands and contract on clicks. 该页面包含手风琴控件,可在单击时扩展和收缩。 When it expands, it's supposed to show the records from the database. 当它扩展时,应该显示数据库中的记录。 It works fine when I first open the page. 当我第一次打开页面时,它工作正常。 But it fails on refresh. 但是刷新失败。 This working fine in IE, Its the problem with Firefox only. 这在IE中工作正常,仅是Firefox的问题。 On Refresh its failing in Firefox. 在刷新它在Firefox中失败。 I tried giving "hPanelLoaded" a value of "FALSE" on page load. 我尝试在页面加载时给“ hPanelLoaded”一个值“ FALSE”。 Still its notworking. 仍然不起作用。 It seems on refresh FF is not able to get the value of "hPanelLoaded" and it says "$("hPanelLoaded") is null". 似乎刷新FF无法获取“ hPanelLoaded”的值,并显示“ $(“ hPanelLoaded”)为空”。

here is the Page structure. 这是页面结构。 MainPage.aspx is calling Control > hPanelLoaded.ascx is calling > hPanelLoaded.js. MainPage.aspx调用Control> hPanelLoaded.ascx调用> hPanelLoaded.js。

Any idea what mistake I am doing. 不知道我在做什么错。

Here is the code 这是代码

@@@@@@@@@@ this is in hPanelLoaded.ascx. @@@@@@@@@@@@在hPanelLoaded.ascx中。 @@@@@@@@@@@ @@@@@@@@@@@

<input type="hidden" id="hPanelLoaded" />     

@@@@@@@@@@ this is in hPanelLoaded.js. @@@@@@@@@@@@在hPanelLoaded.js中。 @@@@@@@@@@@ @@@@@@@@@@@

function loadPanel1() {
    try {
        if ($('hPanelLoaded').value != 'TRUE') {
            grdarts.callback();
            $('hPanelLoaded').value = 'TRUE'
        }
     // else {
              //  alert('INSIDE ELSE');
              //  $('hPanelLoaded').value = 'FALSE';
           // }
    }

Your selector should be 您的选择器应为

$('#hPanelLoaded')

since you are selecting by id (note the addition of the # ) 由于您是按ID选择的(请注意#

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM