c# - Calling PUT method from Javascript -
i'm trying call c# web api javascript, , data doesn't appear passing correctly. method have works fine, can't seem put working intend. here's structure:
javascript:
$.ajax({ type: "put", url: "/api/ftp", data: "hello world" }) c# web api:
public class ftpcontroller : apicontroller { // get: api/ftp public ihttpactionresult get() { } // put: api/ftp public void put([frombody] string data) { } } please let me know if need provide more info. help.
try data:{'':'hello world'}
it generate =helloworld form data , [frombody] expects , it's in case believe.
Comments
Post a Comment