在一个给定的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文件中。
处理这些情况的正确方法是什么?