asp.net - web api returned content missing when posting in angularjs -


i trying post data , return content posting .net web api using angularjs

here web api

[httppost]     public httpresponsemessage post()     {         return new httpresponsemessage()         {             content = new stringcontent(                 "<strong>test</strong>",                 encoding.utf8,                 "text/html"             )         };     } 

and here post client

$http({                 url: 'my happy url',                 method: "post",                 data: objdata,                 headers: {                     'content-type': 'text/html'                 }             }).success(function (data, status, headers, config) {                 console.log(headers());             }).error(function (data, status, headers, config) {                 console.log("error");             }); 

my problem not data returned. sure missing simple. help.

in above code data parameter empty , expect find string "test" in data parameter.

instead of httpresponsemessage, can try use ihttpactionresult? sample code below.

public ihttpactionresult postsample() {     return content(httpstatuscode.ok, "test string"); } 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -