http-post

Which one is better? Ajax post or page post[Controller httppost] when only one form is there in a page?

混江龙づ霸主 提交于 2019-12-10 11:18:36
问题 I have a page called Bookprogram which contains 6 input controls namely, txtName, txtEmail, txtPhone, selectcat[dropdown for categories], txtDate, txtMessage. Now when am done with all the validations for the above control, I want to store the data in db. I know how to perform both in ajax as well as complete page posting. If it's in ajax, after validations, I would just call $.ajax and post the data as a string and fetch it in controller as below: [HttpPost] public JsonResult BookProgram

Consuming Web Service HTTP Post

我是研究僧i 提交于 2019-12-10 10:57:34
问题 I'm consuming a web-service with ServiceStack. The header expected is: POST /SeizureWebService/Service.asmx/SeizureAPILogs HTTP/1.1 Host: host.com Content-Type: application/x-www-form-urlencoded Content-Length: length jsonRequest=string I'm trying to consume it with this code: public class JsonCustomClient : JsonServiceClient { public override string Format { get { return "x-www-form-urlencoded"; } } public override void SerializeToStream(ServiceStack.ServiceHost.IRequestContext

Send xml as part of URL request in Java

牧云@^-^@ 提交于 2019-12-10 10:48:46
问题 This might be a trivial question but I'm trying to send web request to USPS to get a http post response (or email response depending on my request) containing the tracking information based on the tracking number that I send in. The documentation says the xml needs to appended as part of the url like below http://secure.shippingapis.com/ShippingAPITest.dll?API=TrackV2&XML=<PTSEmailRequest USERID="xxxxx"><TrackId>xxxxx</TrackId><RequestType>EN</RequestType></PTSEmailRequest> I saw there were 2

Java + jackson parsing error Unrecognized character escape

余生长醉 提交于 2019-12-10 10:09:19
问题 I need to do a POST json string , using HttpClient. Following will be the code i have. From the other end the Json is mapped to an object. HttpClient client = HttpClientBuilder.create().build(); HttpPost post = new HttpPost(url); String jsonData = "{ \"provider\" : null , \"password\" : \"a\", \"userid\" : \"mlpdemo\\mlpdemoins\" }"; post.setEntity(new ByteArrayEntity( jsonData.toString().getBytes("UTF8"))); HttpResponse response = client.execute(post); Here all others are correctly mapping

Sending form with POST method and Polymer iron-form?

◇◆丶佛笑我妖孽 提交于 2019-12-10 09:56:18
问题 i use Polymer starter kit 1.0.2 and i'm trying to use iron-form based on (little) documentation i found. My method form is "post" and contain only one input. My form "action" is a PHP script (add.php) showing content of $_GET and $_POST: print_r($_POST); print_r($_GET); My form component (form_eclp.html) is: <dom-module id="my-form"> <template> <div class="horizontal center-center layout"> <div> <div class="horizontal-section"> <form is="iron-form" id="formGet" method="post" action="add.php">

Show a different value from an input that what will be received as php

筅森魡賤 提交于 2019-12-10 04:03:21
问题 I'd like to know if there is a way to show in an input of type text a different value than the one send to PHP. For example, let say you have : <input type="text" value="John"> that display John. Can I change the value to "Doe" for the user but keep it to "John" for php? Can I achieve this using the difference between $.attr('value') and $.val() ? I ran a couple of tests and it seems that I will have to reverse it directly in my controller. Is there an other solution? Here is a little

JAVA: http post request

自作多情 提交于 2019-12-10 03:42:04
问题 I have to do post request to a web-service to authenticating the user with username and password. I have a problem with following post request: public String postTest(String action, ConnectionParametrData [] parameters) { Uri.Builder builder = new Uri.Builder().scheme(scheme).authority(authority).path(action); uri = builder.build(); BufferedReader in = null; String ans = null; HttpPost request = new HttpPost(uri.toString()); HttpClient defaultClient = new DefaultHttpClient(); try { request

POSTing data to WebApi after update to 5.1.0 fails

假如想象 提交于 2019-12-10 02:26:36
问题 I have an web app that use webapi for loading / saving data All used to work ok/ Today I found that there is an updated to ASP.NET MVC / webapi, and I installed the update But after that POSTing data with jquery no longer works. I made no change either in client code or in webapi controller. My typical POSt statement looks as below: showProgress(true, self.PanelID(), 'Saving...') j$.ajax({ type: "POST", url: uri, data: dataObj, error: function (jqXHR, status, error) { showProgress(false);

Posting JSON using JQuery and to set HTTP content type - 'application /json'

不问归期 提交于 2019-12-10 02:22:25
问题 I am using jquery to post Json data to server. However when I make a post request as below, $.ajax({ type : 'POST' , url : uri, data : jsonStrJson, contentType : 'application/json', success : successFunction }); The http request header content type is not "application/json" even though I posting a json object. Since it is not applcation/json, the server does not process the requset and returns 415. Is there a way to set the header using javascript or jquery API? 回答1: Can you try this, $.ajax(

GWT: How to send POST cross domain requests with JSON

梦想与她 提交于 2019-12-10 00:08:30
问题 As its Javadocs suggest, the JsonpRequestBuilder can only send GET requests. I need to send POST requests using the same method (for cross domain requests using JSON). Does anybody know any working solution? I could not find any starting point on the web. thanks in advance 回答1: You can't use JSONP to do a POST - all it does is inserting a <script src="..."> tag, and the browser fires off a GET request. Maybe what you're looking for is CORS, but that's only supported by FF 3.5, IE 8 and Safari