Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
could you please give me the code for passing parameter through the get method in jQuery and also the code for getting that parameter in webapi controller???
Posted

1 solution

I think you should use $.ajax as $.get calls $.ajax internally anyway.

$.ajax({
                type: "GET",
                url: '/api/MyWebApiController/' + data,              
                success: function (result) { },
                error: function (e) { }
     });


On the Web Api controller side:

SQL
public String GetNameById(Int32 id)
        {
            return GetNameById(id);
        }


Note:- This 'GetNameById' should reside in your 'MyWebApiController'.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900