<script> // ajax的get請求,使用函數向其url添加參數 function addURLParam(url,name,value){ url+=(url.indexOf('?')==-1?'?':'&'); url+=encodeURIComponent(name)+'='encodeURIComponent(value); return url; } //使用 var url='example.php'; url=addURLParam(url,'name','nainai') </script>