jQueryを介してperlスクリプトへのajax呼び出しを介して記述されたDIVがあります-そして、成功すると.html()で記述されます
書き込まれた html には複数の DIV が含まれています。各 DIV には、スタイリング用の css ファイルに ID とエントリがあります。
私が抱えている問題は、テキストが書かれているときにスタイリングが無視されることです。
例:
HTML:
<link rel="stylesheet" type="text/css" href="layout.css" />
...
<div id="CONTAINER"></div>
JavaScript:
$.ajax({
url: './GetInfo.pl',
success: function(data) {
alert(data); // to check the right html is returned - and it is!
$('#CONTAINER').html(data);
}
});
CSS:
body { color: black; font-size: 10pt; }
#childDiv1 { color: #ffffff; font-size: 12pt; }
#childDiv2 { color: #ffff00; font-size: 14pt; }
#childDiv3 { color: #ff00ff; font-size: 16pt; }
パール:
print <<HTML;
Content-type: text/html
<div id="childDiv1">Info 1</div>
<div id="childDiv2">Info 2</div>
<div id="childDiv3">Info 3</div>
HTML
.... すべての DIV に正しいテキストがありますが、スタイリングは新しい DIV エントリではなく、CSS ファイルの BODY エントリから取得されます。