So how would I ideally encode the data? In a previous function i was using
$.ajax to post data and the variables were available in response.post_vars.
On Saturday, December 29, 2012 4:45:17 PM UTC+4, Niphlod wrote:
>
> if you have only a json string posted sent without being encoded
> (multipart/form-data) you have the json directly in response.body .
> request.post_vars is filled only if data comes encoded.
>
> On Saturday, December 29, 2012 1:28:23 PM UTC+1, vivek wrote:
>>
>> Hi i been using angularjs to develop my front end . I am using http.post
>> to send data to web2py. The POST tab under firebug shows a valid JSON being
>> posted.
>>
>> Now in my controller I believe my request.post_vars is empty. I tried
>> using simplejson.loads , but it throws me an error expected string or
>> buffer
>>
>> I used a simple return statement like this return dict(data =
>> request.post_vars) but it returns an empty "data"
>>
>> Am not sure which side of the code I should paste here
>>
>>
>> $http.post($scope.url, {"data" : $scope.filter}).
>> success(function(data, status){
>> $scope.status = status;
>> $scope.phmdata = data.data;
>>
>>
>> }).
>> error(function (data, status){
>> $scope.status=status;
>> });
>> };
>> Thats my post code. data produces a JSON which i verified using JSON-lint
>>
>> Please help
>>
>>
--