Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

How to call custom action by jquery

$
0
0

suppose the below code is my web api code

public class ProductsController : ApiController
{
    public IEnumerable<Product> GetAll() {}
    public Product GetById(int id, double version = 1.0) {}
    [HttpGet]
    public void FindProductsByName(string name) {}
    public void Post(Product value) {}
    public void Put(int id, Product value) {}
}

now how could i specify action method name when i like to call action by jquery.

how jquery url would look like for GetAll(), GetById(int id, double version = 1.0), FindProductsByName(), Post,Put etc.

please guide me what step i need to do and how jquery ajax code would look like to call action method with custom name.

thanks


Viewing all articles
Browse latest Browse all 4850

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>