post

jquery post codeigniter validation

痴心易碎 提交于 2020-01-11 07:06:50
问题 We are using jquery to .load() a form into a div We then use jquery to .post() that form to a codeigniter controller ie /app/post We then want Codeigniter to perform validation but were not sure how to return to a page to display the validation errors? If re re .load() the controller wont it re-init the object and we lose the data? Are we approaching this in the wrong way? 回答1: Store the validation messages in sessions from your controller and then show them on the corresponding view/page but

How to pass GET and POST data to the php executable?

微笑、不失礼 提交于 2020-01-11 03:06:14
问题 I am writing a web server in C# and I'm trying to add support for PHP. I have it mostly working, except I don't know how to past GET and POST data to the PHP executable when i pass the file to it. I've been testing with GET since I haven't gotten to getting POST requests handled on the server, and I have the string of the arguments that gets passed separated, but I don't know how to feed the information to the php parser. Some tips would be appreciated. 回答1: For GET: The Easy Way (That i've

hide variables passed in URL

删除回忆录丶 提交于 2020-01-11 02:23:45
问题 We've been working on a web application and we've just about got it finished up, but there's one thing that bothering us (although by no means is it going to stop production.) When we call one of the pages (index.html), we sometimes have to pass it a variable in the URL (searchid). So we get a page like http://domain.com/index.html?searchid=string . We'd ideally like to not show the ?searchid=string , but I'm not sure how we'd do that. My group doesn't own the index.html page (but we are

How do I use the “Post/Redirect/Get” a.k.a. “Redirect after Post” with asp.net

寵の児 提交于 2020-01-10 15:44:26
问题 Doing a refresh after certain action in asp.net seems to make them happen again even when that action doesn't make sense (think double delete). The web way to deal with this situation is to redirect after a post to get a clean version of the page that can be refreshed without reposting an action to the webserver. How can I do this with ASP.NET 回答1: I have a feeling there is a deeper problem I'm not getting but here goes. In your postback event: // the post handling logic, e.g. the click event

http请求之get和post的区别

跟風遠走 提交于 2020-01-10 14:27:00
http请求之get和post的区别 前言: 大家现在度娘一下,查得最多的区别,可能就是: “Get把参数写在URL中,Post通过请求体来传参的” “GET没有POST安全,因为Get参数直接显示在URL上” “Get请求在URL中传送的参数是有长度限制的,而POST是没有的” 但是,真相是这样的吗?!!!真相永远只有一个!!! 先分析一波: GET和POST与数据如何传递没有关系??   GET和POST是由HTTP协议定义的。那么使用哪个方式与应用层的数据如何传输是没有相互关系的。从而,HTTP就没有要求,POST一定要放到请求体里面,GET就一定要放到URL里面。   在HTML标准中,是有着类似的定义。但这只是HTML标准对HTTP协议的用法的约定。也就是规范上说,无区别。   那么,这个说法是从何而来的呢?是因为有各种浏览器等软件的实现,就变成了我们现在熟知的现象,GET要用URL传参,POST用body传参。 HTTP协议对GET和POST有没有对长度的限制??   HTTP协议明确地指出了,HTTP请求头和请求体都没有长度的要求。   而对于URL长度上的限制,有两方面的原因造成:   1. 浏览器。据说IE对URL长度会限制在2048个字符内。但是就我所知,firefox是支持10W以上的长度。   2. 服务器。服务器处理超长的URL本身就是一种负担

Android Retrofit | Post custom object (send json to server)

試著忘記壹切 提交于 2020-01-10 12:47:53
问题 I was wondering how could I go about sending a custom object to my API using retrofit, something like this: @POST(URL_ORDERS) public void newOrder(Order order, Callback<Boolean> success); Here's how I'd parse it on my server public function store() { if(Auth::check()){ $order = Input::get(); $table = $order->table; $items = $order->items; if(!$table->taken){ $table->taken = true; $order->push(); $table->push(); return true; } } return false; } For some reason I'm getting 06-04 20:45:59.275

彻底掌握CORS跨源资源共享

陌路散爱 提交于 2020-01-10 11:22:53
本文来自于公众号链接: 彻底掌握CORS跨源资源共享 ) 本文接上篇公众号文章: 彻底理解浏览器同源策略SOP 一.概述 在云时代,各种SAAS应用层出不穷,各种互联网API接口越来越丰富,H5技术在微信小程序、支付宝小程序、Hybird中大行其道,所有的这些都离不开跨源访问。 CORS即跨源资源共享(Cross-Origin Resource Sharing),是由W3C组织维护的处于稳定状态的浏览器跨源访问规范,被现代主流版本浏览器充分支持。在普通的web应用跨源访问server的场景下,CORS是最优的跨源访问方案。对比其他的方案,如iframe标签嵌套方案不够安全,JSONP方案功也只支持GET方法,CORS的安全性高且功能完善。 什么是跨源访问 现代浏览器都支持同源策略SOP。假如有网站: A:http://www.exampleA.com B:http://www.exampleB.com A的web页调用B的资源,此时因为A和B的源不同,就发生了跨源访问。根据SOP规范,在默认情况下A的web页是无法访问到B的资源的。CORS在尽量保证安全的前提下,放宽了SOP限制,使得浏览器可以跨源访问服务器资源。 关于SOP细则,请参考上篇公众号文章 : 彻底理解浏览器同源策略SOP 插图:corsflow 除了最常用的XMLHttpRequest(AJAX

How to convert an object to JSON correctly in Angular 2 with TypeScript

心不动则不痛 提交于 2020-01-10 06:52:27
问题 I'm creating an Angular 2 simple CRUD application that allows me to CRUD products. I'm trying to implement the post method so I can create a product. My backend is an ASP.NET Web API. I'm having some trouble because when transforming my Product object to JSON it is not doing it correctly. The expected JSON should be like this: { "ID": 1, "Name": "Laptop", "Price": 2000 } However, the JSON sent from my application is this: { "product":{ "Name":"Laptop", "Price":2000 } } Why is it adding a

Upload image with http.post and registration form in Flutter?

假如想象 提交于 2020-01-10 05:38:05
问题 so i want to upload a File (image) to a server with a bunch of other variable (Strings) String firstname , lastname , birthDay, phone , adresse ; File image; return http.post( uri, headers: { 'Accept': 'application/json', "Authorization": "Bearer $token", }, body: body, encoding: encoding, ); Future<http.Response> postRegisteration() async { return await api.httpPost('fotApp/master', body: { 'firstname': 'lorem', 'lastname': 'lorem', 'birthDay': 'lorem', 'adresse': 'lorem', 'phone': 'lorem',

SpringMVC学习笔记(三)

我的未来我决定 提交于 2020-01-10 04:13:15
SpringMVC RESTful风格 RESTful风格简述 RESTful的核心内容 RESTful架构特点 SpringMVC下使用RESTful风格进行开发 处理PUT和DELETE请求 源码 RESTful风格简述 REST:Representational State Transfer(表述性状态转移),他不是一种创新技术,他指的是一组架构约束条件和原则,若一个架构符合REST的约束条件和原则架构,那么他就称为RESTful架构。 RESTful的核心内容 表述性状态转移,所谓的表述指的是 资源 的表述,资源就是真实存在的资源(图片、文本、视频、音频等)可以被调用的资源,若要使得该资源被调用那么就需要有唯一标示即 URI 。状态的转移指的是资源在客户端发生变迁,进入后续的状态,通俗来说就是用户改变资源后,服务器需要进行相应的变动操作。 RESTful架构特点 统一了客户端访问资源的接口,无论后台什么样的资源都是通过相同的接口进行访问 url更加简洁,易于理解,便于拓展 有利于不同系统间的资源共享(依托于第一点的统一接口) 我们知道HTTP协议的有两种基本形式有:GET、POST。 RESTful具体来讲就是HTTP协议的四种形式表示四种基本操作,所对应的操作如下: GET:获取资源 POST:新建资源 PUT:修改资源(POST) DELETE:删除资源 (POST)