asp.net mvc - angularjs function not invoking mvc controller method -


hi trying access method through angularjs when click button hits function not invoke controller actionresult when manually add url in calls method.

here angular code:

$http({ method: 'get', url: '/home/getemployeelist?=' + search }).     success(function (data, status, headers, config) {         $scope.customers = data;     }).     error(function (data, status, headers, config) {         alert('error');     });      } 

and here controller:

public jsonresult getemployeelist(string search)     {         search = "lourens";         list<quotation> quote = new list<quotation>();         using (specialhireentities sp = new specialhireentities())         {             var quotes = sp.quotations.where(x => x.clientname == search).tolist();             return new jsonresult { data = quotes, jsonrequestbehavior = jsonrequestbehavior.allowget };         }     } 

the url in first line of js should

$http({ method: 'get', url: '/home/getemployeelist?search=' + search }). 

rather than

$http({ method: 'get', url: '/home/getemployeelist?=' + search }). 

with code mentioned, mvc model binding never able find value variable 'search' request not resolved ending in exception


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -