<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>