var requestURL = "api/EmployeeApi/GetEmployeeByName";
var dataJSON = {};
dataJSON["name"] = "Albert";
$.ajax({
url: requestURL,
data: JSON.stringify(dataJSON),
type: "POST",
dataType: "json",
contentType: "application/json;charset=utf-8",
success: function(returnData){
console.log(returnData);
},
error: function(xhr, ajaxOptions, thrownError){
console.log(xhr.status);
console.log(thrownError);
}
});
#button_search
1.我覺得你先用postman測試你的後端要輸入怎樣的url 才可以回傳訊息
把postman成功get樣子放上來可以更好幫助你找問題
版上postman文章:https://ithelp.ithome.com.tw/articles/10201503
2.我猜你要get的url可能長api/EmployeeApi/GetEmployeeByName?name=Albert