I am trying to use ajax call on asp.net web api where i want to alias the request model property name.
However, when i post the value back to the server and receive it as request, it does not work as expected. what i intend to achieve is as follow:
When i pass the data valueA back to web api, it will mapped to MemberName. Not sure where i did wrong.
THis is what something i expect.
$.ajax({
url: '..',
dataType: 'json',
type: 'POST',
data: { 'valueA': 'ABC' },
success: {}
})
public class MemberProfile {
[JSONProperty('valueA')]
public string MemberID { get; set; }
}
[HttpPost]
public HttpResponseMessage GetMemberProfile(MemberProfile request)
{
}
</div>