GET vs POST in AJAX?

You should use the proper HTTP verb according to what you require from your web service. When dealing with a Collection URI like: http://example.com/resources/ GET: List the members of the collection, complete with their member URIs for further navigation. For example, list all the cars for sale. PUT: Meaning defined as “replace the entire collection … Read more

Multiple Ajax requests for same URL

Necko’s cache can only handle one writer per cache entry. So if you make multiple requests for the same URL, the first one will open the cache entry for writing and the later ones will block on the cache entry open until the first one finishes. There’s work ongoing to rearchitect the cache to remove … Read more

Angular 2 HTTP Progress bar

Currently (from v. 4.3.0, when using new HttpClient from @ngular/common/http) Angular provides listening to progress out of the box. You just need to create HTTPRequest object as below: import { HttpRequest } from ‘@angular/common/http’; … const req = new HttpRequest(‘POST’, ‘/upload/file’, file, { reportProgress: true, }); And when you subscribe to to request you will … Read more

phonegap: cookie based authentication (PHP) not working [webview]

i figured it out: you have to change the phonegap_delegate.m file and add the following to the init method: – (id) init { /** If you need to do any extra app-specific initialization, you can do it here * -jm **/ //special setting to accept cookies via ajax-request NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; [cookieStorage setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways]; … Read more

Ajax update and submission using h:commandButton

This is to be done by nesting a <f:ajax> in it. In effects, <p:commandButton … process=”@form” update=”:statusBlock” /> does exactly the same as <h:commandButton …> <f:ajax execute=”@form” render=”:statusBlock” /> </h:commandButton> Note that the subtle difference with the PrimeFaces equivalent is that PrimeFaces defaults to @form in the process/execute, while the <f:ajax> one defaults to @this, … Read more

Conditionally provide either file download or show export validation error message

Is there any generally acceptable way of solving issues like this one? You basically want to fire an ajax request first and in its oncomplete check if it’s successful, and then trigger a synchronous request to download the file (note that you can’t download files with ajax). You could make use of FacesContext#validationFailed() (or OmniFaces … Read more

localhost :: cross domain ajax

It’s very possible. Let’s start with a dev browser. Step 1: Download Chromium Windows — http://www.chromium.org/getting-involved/download-chromium Mac — http://www.macupdate.com/app/mac/36244/chromium/ There should be a build ready to go, but these locations change over time. So if these end up with 404’s do a Google search for Windows Chromium Download and you’ll find it. Step 2: Then … Read more