AngularJS passing data to $http.get request

前端 未结 7 783
无人及你
无人及你 2020-11-22 13:01

I have a function which does a http POST request. The code is specified below. This works fine.

 $http({
   url: user.update_path, 
   method: \"POST\",
   d         


        
7条回答
  •  轮回少年
    2020-11-22 13:20

    Here's a complete example of an HTTP GET request with parameters using angular.js in ASP.NET MVC:

    CONTROLLER:

    public class AngularController : Controller
    {
        public JsonResult GetFullName(string name, string surname)
        {
            System.Diagnostics.Debugger.Break();
            return Json(new { fullName = String.Format("{0} {1}",name,surname) }, JsonRequestBehavior.AllowGet);
        }
    }
    

    VIEW:

    
    
    
    

提交回复
热议问题