特定のphpスクリプト内には、次のものがあります。
<script>
function showMember() {
return $.ajax({ //Perform an asynchronous HTTP (Ajax) request.
type: 'get',
//A string containing the URL to which the request is sent.
url: '<?php echo $this->createUrl('member'); ?>',
...
これをphpファイル内に配置すると、これが機能します。
しかし、これは物事を整理するための良い方法ではないようです。私は、このすべてのコードを別の .js ファイルに配置したいと考えています。
これらのシナリオに対処するための適切な方法は何ですか?