The problem is more likely to be with your back-end. I had something
similar in PHP where the JSON data does not get noticed because it's not a
normal part of a POST request.
So I had to check the headers when receiving post.
e.g.
> $headers = getallheaders();
> if(strstr($headers['Accept'],'json') {
> $post = file_get_contents("php://input");
> }
On Sunday, January 26, 2014 7:20:38 PM UTC+2, Tob wrote:
>
> Hi all,
>
> I want submit my Form with POST / RESTful JSON to a WebService.
> Unfortunately, JSON does not work, I have to submit my form with String!!
> It works but I don't like this way very much, this is why I had to change
> the content-type (application/x-www-form-urlencoded).
>
>
> My code:
> 'create' : function(task) {
> $http.defaults.headers.post["Content-Type"] =
> "application/x-www-form-urlencoded";
>
> task.SectionId = task.Sections.SectionId;
> var promise = $http({
> url: baseURL + 'Tasks/AddOrUpdateTask/',
> method: 'POST',
> data: $.param(task).replace('&Sections%5BTasks%5D=','')
> })
> .success(function(data, status, headers, config) {
> console.log("saved OK");
> })
> .error(function(data, status, headers, config) {
> alert("saved Error " + status + ' ' + headers);
> })
>
> return promise;
> },
>
> Thank you for a better understanding. and guide me for a better solution.
>
> regards
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.