次のコードを検討してください。
これは、 leader-module-totalというIDを持つアンカータグであり、押されると、PHPスクリプトを呼び出し、leader-moduleというID内のPHPコードで実行されたエコーを表示します。
十分に基本的です。
ただし、これを行うたびに、このスニペットの最後のコードを使用して「縮小」する必要があります。
私の質問は、どうしてですか?私はここで何か間違ったことをしていますか?
$('#leader-module-total').click(function() {
//load an image to show while processing
$('#leader-module').html( '<div class="ajaxLoader"></div>' );
//process the php script -- btw, is this valid i.e. calling it using /
//and not fully qualified with http://mydomain/page-to-be-called
$.get('/ajax-leader-module-response.php', { timeframe: 'total' },
function(data){
$('#leader-module').html( data );
}
);
//this is my question: why is this necessary???
//I need to make it smaller than it was for it to display normally.
$('#leader-module').css('font-size', '0.9333em');
return false;
});