AngularJS POST GET example
程序员文章站
2022-03-02 13:47:54
...
You can use this in Controller file to use get & post method.
var turtle_data = {Sun:"English"}
var turtle_url = "http://127.0.0.1:7000/exercise/test/user_data/123/ccy"
$http({
method:"post",
url: turtle_url,
data: turtle_data
}).
success(function(data, status) {
alert(JSON.stringify(data)+'#post#'+status+'#1')
}).
error(function(data, status) {
alert(JSON.stringify(data)+'#post#'+status+'#1')
});
post
get
$http({
method: "get",
url: turtle_url
}).
success(function(data, status) {
alert(JSON.stringify(data)+'#get#'+status+'#0')
}).
error(function(data, status) {
alert(JSON.stringify(data)||"Request failed"+'#get#'+status+'#0')
});
转载于:https://my.oschina.net/coderman/blog/174344
上一篇: Eureka启动报错Cannot execute request on any known server
下一篇: spring+hibernate4异常org.hibernate.HibernateExc和createCriteria is not valid without active transaction
推荐阅读
-
php过滤所有恶意字符(批量过滤post,get敏感数据)
-
php中$_REQUEST、$_POST、$_GET的区别和联系小结
-
如何解决Ajax访问不断变化的session的值不一致以及HTTP协议中的GET、POST的区别
-
jQuery Ajax 实例详解 ($.ajax、$.post、$.get)
-
AngularJS封装$http.post()实例详解
-
Jquery中$.get(),$.post(),$.ajax(),$.getJSON()的用法总结
-
Angularjs中$http以post请求通过消息体传递参数的实现方法
-
php中$_GET与$_POST过滤sql注入的方法
-
详谈jQuery Ajax(load,post,get,ajax)的用法
-
JAVA POST与GET数据传递时中文乱码问题解决方法