Method Source: http://victorblog.com/2012/12/20/make-angularjs-http-service-behave-like-jquery-ajax/
$http
Services (and $http.post()
so on) are not equivalent to jquery ( jQuery.post()
etc.),
The difference is how jquery and Angularjs serialize and transfer data. Fundamentally, the problem is that the server language selection does not understand the ANGULARJS transmission locally ...
By default, jquery transmits data using Content-Type: x-www-form-urlencoded and the familiar foo=bar&baz=moe
serialization.
Angularjs However, with the sending of data Content-Type: application/json
and { "foo": "bar", "baz": "moe" }
JSON serialization, unfortunately some Web server languages ( especially PHP) cannot be locally de-serialized.
Workaround:
Locate and change the following settings in the angular source code:
Front-End Code:
PHP Code:
AngularJS $http POST-Transfer parameter