2010-11-18 2 views
2

J'utilise jQuery pour effectuer une requête $ .get.Pourquoi ce code HTML provoque l'effacement de la page

$.get(url, {}, function (result) { 
     $('#FactsheetTabs .tab_container div:visible').fadeOut(100, function() { 
      $('#FactsheetTabs .tab_container') 
      .html(result) 
      .fadeIn(100); 
}); 

L'objet de réponse contient (entre autres choses) le code HTML suivant:

<img 
    id="VB_2wCo_bvai" 
    name="VB_2wCo_bvai" 
    width="570" height="243" 
    style="border:0;" 
    usemap="#imVB_2wCo_bvai" 
    src="http://ie-sv-corda72:2001/[email protected]_CPRVB_2wCo_bvai" /> 
    // this URL is to an image on one of our internal servers 

Le problème est que Firefox ou Chrome (comme je peux voir dans l'onglet net de Firebug), après la fonction .html(result) s'exécute, le navigateur lance un nouveau reqeust pour obtenir l'image .. et cela se traduit simplement par une page blanche apparaissant dans le navigateur, plutôt que le nouveau rendu HTML sur l'écran avec l'image.

Quelqu'un at-il déjà vu un problème comme celui-ci? aucune idée pour résoudre ça?

Edit: Le code de réponse complète est la suivante:

<script type="text/javascript"> 
    var put1006635006Props; 
    var put1747344981Props; 
    var put518384227Props; 

    function getImageMap208345221() { 
     put1006635006Props = new PopUpProperties; 
     put1006635006Props.width = 400; 
     put1006635006Props.textColor = "#000000"; 
     put1006635006Props.textSize = "12.0"; 
     put1006635006Props.textFont = "Helvetica"; 
     put1006635006Props.fillColor = "#ffffe1"; 
     put1006635006Props.borderColor = "#000000"; 
     put1006635006Props.hpos = LEFT; 
     put1006635006Props.vpos = ABOVE; 
     put1006635006Props.justification = "LEFT"; 
     put1747344981Props = new PopUpProperties; 
     put1747344981Props.width = 400; 
     put1747344981Props.textColor = "#000000"; 
     put1747344981Props.textSize = "12.0"; 
     put1747344981Props.textFont = "Helvetica"; 
     put1747344981Props.fillColor = "#ffffe1"; 
     put1747344981Props.borderColor = "#000000"; 
     put1747344981Props.hpos = CENTER; 
     put1747344981Props.vpos = ABOVE; 
     put1747344981Props.justification = "LEFT"; 
     put518384227Props = new PopUpProperties; 
     put518384227Props.width = 400; 
     put518384227Props.textColor = "#000000"; 
     put518384227Props.textSize = "12.0"; 
     put518384227Props.textFont = "Helvetica"; 
     put518384227Props.fillColor = "#ffffe1"; 
     put518384227Props.borderColor = "#000000"; 
     put518384227Props.hpos = RIGHT; 
     put518384227Props.vpos = ABOVE; 
     put518384227Props.justification = "LEFT"; 

     document.writeln('<map name="imVB_2wCo_bvai" id="imVB_2wCo_bvai"><area shape="poly" coords="540,52,547,52,547,59,540,59,540,52" onmouseover="return showPopUp ? showPopUp(put1006635006Props, \'VB_2wCo_bvai\', \'Schroder All Mats Idx Lnkd Bd I Acc 2.58%\', 543, 49) : false;"/><area shape="poly" coords="497,41,504,41,504,48,497,48,497,41" onmouseover="return showPopUp ? showPopUp(put1747344981Props, \'VB_2wCo_bvai\', \'Schroder All Mats Idx Lnkd Bd I Acc 3.27%\', 500, 38) : false;"/><area shape="poly" coords="454,49,461,49,461,56,454,56,454,49" onmouseover="return showPopUp ? showPopUp(put1747344981Props, \'VB_2wCo_bvai\', \'Schroder All Mats Idx Lnkd Bd I Acc 2.77%\', 457, 46) : false;"/><area shape="poly" coords="411,76,418,76,418,83,411,83,411,76" onmouseover="return showPopUp ? showPopUp(put1747344981Props, \'VB_2wCo_bvai\', \'Schroder All Mats Idx Lnkd Bd I Acc 1.14%\', 414, 73) : false;"/><area shape="poly" coords="368,98,375,98,375,105,368,105,368,98" onmouseover="return showPopUp ? showPopUp(put1747344981Props, \'VB_2wCo_bvai\', \'Schroder All Mats Idx Lnkd Bd I Acc -0.2%\', 371, 95) : false;"/><area shape="poly" coords="325,91,332,91,332,98,325,98,325,91" onmouseover="return showPopUp ? showPopUp(put1747344981Props, \'VB_2wCo_bvai\', \'Schroder All Mats Idx Lnkd Bd I Acc 0.25%\', 328, 88) : false;"/><area shape="poly" coords="281,108,288,108,288,115,281,115,281,108" onmouseover="return showPopUp ? showPopUp(put1747344981Props, \'VB_2wCo_bvai\', \'Schroder All Mats Idx Lnkd Bd I Acc -0.79%\', 284, 105) : false;"/><area shape="poly" coords="238,106,245,106,245,113,238,113,238,106" onmouseover="return showPopUp ? showPopUp(put1747344981Props, \'VB_2wCo_bvai\', \'Schroder All Mats Idx Lnkd Bd I Acc -0.69%\', 241, 103) : false;"/><area shape="poly" coords="195,120,202,120,202,127,195,127,195,120" onmouseover="return showPopUp ? showPopUp(put1747344981Props, \'VB_2wCo_bvai\', \'Schroder All Mats Idx Lnkd Bd I Acc -1.49%\', 198, 117) : false;"/><area shape="poly" coords="152,160,159,160,159,167,152,167,152,160" onmouseover="return showPopUp ? showPopUp(put1747344981Props, \'VB_2wCo_bvai\', \'Schroder All Mats Idx Lnkd Bd I Acc -3.96%\', 155, 157) : false;"/><area shape="poly" coords="109,97,116,97,116,104,109,104,109,97" onmouseover="return showPopUp ? showPopUp(put1747344981Props, \'VB_2wCo_bvai\', \'Schroder All Mats Idx Lnkd Bd I Acc -0.15%\', 112, 94) : false;"/><area shape="poly" coords="66,92,73,92,73,99,66,99,66,92" onmouseover="return showPopUp ? showPopUp(put1747344981Props, \'VB_2wCo_bvai\', \'Schroder All Mats Idx Lnkd Bd I Acc 0.2%\', 69, 89) : false;"/><area shape="poly" coords="23,95,30,95,30,102,23,102,23,95" onmouseover="return showPopUp ? showPopUp(put518384227Props, \'VB_2wCo_bvai\', \'Schroder All Mats Idx Lnkd Bd I Acc 0%\', 26, 92) : false;"/><area shape="rect" coords="0,0,570,570" onmouseover="return hidePopUp ? hidePopUp() : false;"/></map>'); 
    } 
</script> 
<script type="text/javascript"> 
    <!-- Check to see if the jsPopUp code is already included 
    if(typeof jsPopUp == 'undefined') { 
     document.writeln('<script type="text/javascript" src="http://ie-sv-corda72:2001/?jsPopUp"></scr'+'ipt>'); 
    } 
    if(document.layers) getImageMap208345221(); 
    //--> 
</script> 
<img 
    id="VB_2wCo_bvai" 
    name="VB_2wCo_bvai" 
    width="570" height="243" 
    style="border:0;" 
    usemap="#imVB_2wCo_bvai" 
    src="http://ie-sv-corda72:2001/[email protected]_CPRVB_2wCo_bvai" /> 
<script type="text/javascript"> 
    if (!document.layers) getImageMap208345221(); 
</script> 
<noscript> 
    <map name="imVB_2wCo_bvai" id="imVB_2wCo_bvai"> 
     <area shape="poly" coords="540,52,547,52,547,59,540,59,540,52" alt="Schroder All Mats Idx Lnkd Bd I Acc 2.58%" /> 
     <area shape="poly" coords="497,41,504,41,504,48,497,48,497,41" alt="Schroder All Mats Idx Lnkd Bd I Acc 3.27%" /> 
     <area shape="poly" coords="454,49,461,49,461,56,454,56,454,49" alt="Schroder All Mats Idx Lnkd Bd I Acc 2.77%" /> 
     <area shape="poly" coords="411,76,418,76,418,83,411,83,411,76" alt="Schroder All Mats Idx Lnkd Bd I Acc 1.14%" /> 
     <area shape="poly" coords="368,98,375,98,375,105,368,105,368,98" alt="Schroder All Mats Idx Lnkd Bd I Acc -0.2%" /> 
     <area shape="poly" coords="325,91,332,91,332,98,325,98,325,91" alt="Schroder All Mats Idx Lnkd Bd I Acc 0.25%" /> 
     <area shape="poly" coords="281,108,288,108,288,115,281,115,281,108" alt="Schroder All Mats Idx Lnkd Bd I Acc -0.79%" /> 
     <area shape="poly" coords="238,106,245,106,245,113,238,113,238,106" alt="Schroder All Mats Idx Lnkd Bd I Acc -0.69%" /> 
     <area shape="poly" coords="195,120,202,120,202,127,195,127,195,120" alt="Schroder All Mats Idx Lnkd Bd I Acc -1.49%" /> 
     <area shape="poly" coords="152,160,159,160,159,167,152,167,152,160" alt="Schroder All Mats Idx Lnkd Bd I Acc -3.96%" /> 
     <area shape="poly" coords="109,97,116,97,116,104,109,104,109,97" alt="Schroder All Mats Idx Lnkd Bd I Acc -0.15%" /> 
     <area shape="poly" coords="66,92,73,92,73,99,66,99,66,92" alt="Schroder All Mats Idx Lnkd Bd I Acc 0.2%" /> 
     <area shape="poly" coords="23,95,30,95,30,102,23,102,23,95" alt="Schroder All Mats Idx Lnkd Bd I Acc 0%" /> 
    </map> 
</noscript> 
+1

Postez votre code de réponse s'il vous plaît. Vous pourriez envisager de retourner une chaîne json – Bob

+0

Salut Ted, j'ai posté le code de réponse. Merci – DaveDev

Répondre

1

Faire un document.write après que la page a pleinement rendu est une mauvaise chose car il va créer un nouveau document lorsque vous faites cela. Donc, si l'un de vos document.writeln est exécuté dans ce script, cela provoque probablement l'effacement de votre page.

+0

Merci pour l'entrée Chris .. mais pourquoi ce serait un problème avec FireFox et non IE? – DaveDev

+0

Hmmm ... très bonne question. J'ai vu celui-là et j'ai immédiatement assumé. Est-ce que cela fait une différence si vous supprimez les écritures ou si vous supprimez l'image? Ou n'avez-vous pas accès pour modifier cette page qui est demandée? – Chris

+0

le code HTML retourné est servi par un serveur de cartes tiers, donc je ne peux rien faire avec, sauf essayer de remplacer les fonctions 'writeln' par' $ ('body'). Append'. Pourtant, je ne pense pas que ça marchera non plus – DaveDev

Questions connexes