$.ajax({ url:'/comm/test1.php', type:'POST', //GET async:false, //或false,是否异步 data:{ name:'yang',age:25 }, timeout:5000, //超时时间 dataType:'json', //返回的数据格式: beforeSend:function(xhr){ }, success:function(data,textStatus,jqXHR){ }, error:function(xhr,textStatus){ }, complete:function(){ } })
npm 安装jquery
$ npm install jquery --save
打开 build/webpack.base.conf 配置文件
'jqurey':'jqurey', 'jqurey': resolve('/node_moudles/jqurey/src/jqurey')
plgins:[ new webpack.ProvidePlgins({ $ : 'jqurey', 'jqurey':'jqurey' }) ]
原文出处: https://blog.csdn.net/github_37847992/article/details/78128549