博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
AngularJS $http配置为form data 提交
阅读量:4322 次
发布时间:2019-06-06

本文共 800 字,大约阅读时间需要 2 分钟。

AngularJS $http配置为form data 提交

$scope.formData = {};$http({        method: 'POST',        url: '/user/',        // pass in data as strings        data: $.param($scope.formData),         // set the headers so angular passing info as form data (not request payload)        headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8' }     })    .success(function(data) {        console.log(data);        if (!data.success) {            // if not successful, bind errors to error variables            $scope.errorName = data.errors.name;            $scope.errorSuperhero = data.errors.superheroAlias;        } else {            // if successful, bind success message to message            $scope.message = data.message;        }    });

转载于:https://www.cnblogs.com/wancy86/p/5858075.html

你可能感兴趣的文章
vue去掉地址栏# 方法
查看>>
Lambda03 方法引用、类型判断、变量引用
查看>>
was集群下基于接口分布式架构和开发经验谈
查看>>
MySQL学习——MySQL数据库概述与基础
查看>>
ES索引模板
查看>>
HDU2112 HDU Today 最短路+字符串哈希
查看>>
JPanel重绘
查看>>
图片放大器——wpf
查看>>
SCALA STEP BY STEP
查看>>
cocos2d-x学习笔记
查看>>
MySql中的变量定义
查看>>
Ruby数组的操作
查看>>
hdu1181暴搜
查看>>
解码字符串 Decode String
查看>>
json学习笔记
查看>>
工具:linux 性能监控工具-nmon
查看>>
fatal error C1853
查看>>
Ural 1001 - Reverse Root
查看>>
玩转webpack之webpack的entry output
查看>>
java 操作mongodb查询条件的常用设置
查看>>