<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>智能社——http://www.zhinengshe.com</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<style> </style>
<script src="vue.js"></script>
<script src="vue-resource.js"></script>
<script>
window.onload=function(){
new Vue({
el:'body',
data:{ },
methods:{
get:function(){
this.$http.get('a.txt',{
a:1,
b:2
},{
emulateJSON:true//加这个参数才能post发送数据
}).then(function(res){
alert('成功了');
alert(res.data);
},function(res){
alert('失败了');
alert(res.data);
alert(res.status);
});
}
}
});
};
</script>
</head>
<body>
<input type="button" value="按钮" @click="get()">
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>智能社——http://www.zhinengshe.com</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<style> </style>
<script src="vue.js"></script>
<script src="vue-resource.js"></script>
<script>
window.onload=function(){
new Vue({
el:'body',
data:{ },
methods:{
get:function(){//jsonp跨域访问
this.$http.jsonp('https://sug.so.360.cn/suggest',{
word:'a'
}).then(function(res){
alert(res.data.s);
},function(res){
alert(res.status);
});
}
}
});
};
</script>
</head>
<body>
<input type="button" value="按钮" @click="get()">
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>智能社——http://www.zhinengshe.com</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<style> </style>
<script src="vue.js"></script>
<script src="vue-resource.js"></script>
<script>
window.onload=function(){
new Vue({
el:'body',
data:{ },
methods:{
get:function(){
this.$http.jsonp('https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su',{
wd:'a'
},{
jsonp:'cb' //callback名字
}).then(function(res){
alert(res.data.s);
},function(res){
alert(res.status);
});
}
}
});
};
</script>
</head>
<body>
<input type="button" value="按钮" @click="get()">
</body>
</html>

vue6 发请求的更多相关文章

  1. 用apache的httpclient发请求和接受数据

    此处发请求的是用httpclient4,请自己下载所需要的jar包. 发post请求,并得到数据. String url = "http://localhost:8080/lee" ...

  2. ajax是怎么发请求的和浏览器发的请求一样吗?cookie

    下午设置cookie时出现了个问题 用ajax发的post请求php,在php的方法里设置了cookie,然后在浏览器请求的php里打印cookie值但是一直获取不到cookie的值 分析: 1.aj ...

  3. tomcat发请求,查看各个环节的耗时时间

    从一台机器给另一台机器tomcat发请求,查看各个环节的耗时时间 - 业精于勤,荒于嬉:行成于思,毁于随. - CSDN博客https://blog.csdn.net/YAOQINGGG/articl ...

  4. node.js中express模块创建服务器和http模块客户端发请求

    首先下载express模块,命令行输入 npm install express 1.node.js中express模块创建服务端 在js代码同文件位置新建一个文件夹(www_root),里面存放网页文 ...

  5. 使用nginx服务器如果遇到timeou情况时可以如下设置参数,使用fastcgi: fastcgi_connect_timeout 75; 链接 fastcgi_read_timeout 600; 读取 fastcgi_send_timeout 600; 发请求

    使用nginx服务器如果遇到timeou情况时可以如下设置参数,使用fastcgi: fastcgi_connect_timeout 75;  链接 fastcgi_read_timeout 600; ...

  6. PHP通过curl向其它服务器发请求并返回数据

    在很多时候,我们都需要请求第三方的服务器来获取一些数据,比如token,比如百度的主动推送,那么我们的php如何实现向第三方服务器发请求呢?我们可以通过curl来实现 首先定义请求的url,然后创建h ...

  7. 工作总结 用, 隔开数据 后台不可以用 List<string> 接收 get请求直接通过浏览器发请求传数组或者list到后台

    旁边的 css js 为项目的 加载 css js 地址 只加载引用的样式 js http://localhost:8736/LinInFoKPI/ExcelPrint?line=&start ...

  8. 【PHP开发】用curl向https发请求时的35号错误

    放了个假发现以前写的程序的模拟登陆不管用了,中间输出,发现curl向https发请求时没有返回数据,输出错误信息,得到: curl_errno($ch) -----> 35 curl_error ...

  9. 从发请求到AJAX到同源政策

    1  发请求的各种方法 使用form标签(会在当前页面刷新或者新开一个页面刷新) <form action="" method=post/get> <input ...

随机推荐

  1. 多任务-进程之进程池Pool

    1.什么是池? 首先从字面上看,池代表着一个容器,用来承载着某些内容的容器,了解到这里,就对进程池有了一个初步的轮廓. 2.什么是进程池Pool? (1)利用现实中的事物来理解: 对于小白初学者,接触 ...

  2. [HEOI2012]采花(树状数组+离线)

    听说这题的所发和HH的项链很像. 然而那道题我使用莫队写的... 这是一个套路,pre数组加升维(在线). 记录一个\(pre\)数组,\(pre[i]\)代表上一个和i颜色相同的下标. 我们把询问离 ...

  3. Python 安装 httplib2

    简述 httplib2 是一个使用 Python 写的支持的非常全面的 HTTP 特性的库.需要 Python2.3 或更高版本的运行环境,0.5.0 版及其以后包含了对 Python3 的支持. 简 ...

  4. Linux/UNIX线程(1)

    线程(1) 本文将介绍怎样使用多个控制线程在单个进程环境中运行多个任务. 一个进程中的全部线程都能够訪问该进程的组成部件(如文件描写叙述符和内存). 线程包含了表示进程内运行环境必须的信息,当中包含进 ...

  5. 最快的方式清除Chrome浏览器DNS缓存

    最快的方式就是直接数据url,然后清除不须要的dns缓存. chrome://net-internals/#dns 一般步骤.要经过下列几项. Chrome - > 扳手 - > 选项 - ...

  6. ps学习入门篇

    http://www.360doc.com/content/12/0107/21/6932394_177976138.shtml 填充前景色 前景色是ALT+DELETE,背景色是CTRL+DELET ...

  7. thinkPHP的模板是做什么用的

    thinkPHP的模板是做什么用的 问题 为什么PHP中ThinkPHP有做类似模板引擎的东西?smarty也是?这些到底有何用? 我是真没发现它们的用处在哪里?分离了前端和PHP的依赖?HTML文件 ...

  8. 35.angularJS的ng-repeat指令

    转自:https://www.cnblogs.com/best/tag/Angular/ 1. <html> <head> <meta charset="utf ...

  9. Spring4+SpringMVC+MyBatis登录注册详细

    项目结构: package com.mstf.controller; import org.springframework.stereotype.Controller; import org.spri ...

  10. PostgreSQL 系统表

    postgres=# \d pg_class      Table "pg_catalog.pg_class"     Column     |   Type    | Modif ...