Link to home
Get AccessLog in
Avatar of ITsolutionWizard
ITsolutionWizardFlag for United States of America

asked on

ajax jquery + webapi mvc

I use c# to call webapi below on another server, and it works fine.
Can you show me how to convert to jquery call? I am very new in ajax jquery....

Thanks,


  public string GetFleetList(string FleetMasterType, string responseType)
        {
            string RegIDvalue = "0";
            using (System.Net.WebClient client = new System.Net.WebClient())
            {
                var reqparm = new System.Collections.Specialized.NameValueCollection();
                reqparm.Add("FleetMasterType", FleetMasterType);
                byte[] responsebytes = client.UploadValues(domain + "/api/Fleet/GetFleetList?type="+ responseType, "POST", reqparm);
                string responsebody = Encoding.UTF8.GetString(responsebytes);
                RegIDvalue = responsebody;
            }
            return RegIDvalue;
        }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Link to home
membership
This content is only available to members.
To access this content, you must be a member of Experts Exchange.
Get Access