결과의 PHP 배열이 $bank_r
입니다. 모든 결과에서 일부 결과를 수행하려고합니다. 이를 위해 내가 쓴 :JQuery 함수가 PHP 루프 내에서 실행되지 않습니다.
$(function(){
//alert('<?php echo count($bank_r); ?> ');
<?php
for($i=0;$i<count($bank_r);$i++)
{
$bank_name = strtolower (str_replace(" ","",$bank_r[$i]['bank_name']));
?>
alert('<?php echo $bank_name; ?>');
<?php } ?>
-------------
----------
//Some other jquery functions
//
//
});
내가 $bank_name
을 경고하기 위해 기다리고 있었다, 그러나 아니다. 심지어 alert('<?php echo count($bank_r); ?> ');
상단에도 아무 것도 경고하지 않습니다. 그러나 php for loop
을 제거하면 상단의 alert
에 결과 수가 표시됩니다. 뭐가 문제 야 ?
편집 : 자바 스크립트 코드 생성 : 첫 번째 경고에
<?php
for($i=0;$i<count($bank_r);$i++)
{
$bank_name = strtolower (str_replace(" ","",$bank_r[$i]['bank_name']));
echo '<script> alert("'.$bank_name.'");</script>';
// if you are outside the javascript then use script tag, otherwise remove the tags
}
?>
은 'JS'파일입니까 ?? – swapnesh
브라우저 콘솔을 들여다 볼 수 있습니까? 어떤 오류가 있습니까? – antyrat
콘솔 ('F12')에서 오류를 확인 했습니까? –