Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
C#
this.testAjax = function () {
		$http.post("~/Home/About").
       success(function (data1) {
       	if (data1 == "True") {

       	} else {

       	}
       }).
        error(function (re) {
        	if (re == "True") {

        	} else {

        	}
        });
	};


Cotroller Name : HomeController
Action : About

Getting error on path not found.
Posted
Updated 20-Oct-14 2:22am
v2
Comments
Nathan Minier 16-Oct-14 8:03am    
Have you tried $http.post("Home/About")

 
Share this answer
 
PHP
colorApp.controller('Home', function ($scope,$http) {
$http({
    url: '/Home/About',
    method: 'GET'
}).success(function (data, status, headers, config) {
    $scope.color = data;
});
 
Share this answer
 
Comments
hemant malpote 17-Oct-14 5:03am    
it does not works.
this.GetAllEmployee = function (filterField) {
// Initiates the AJAX call
$http({ method: 'POST', url: '/Home/GetEmployeeList', data: $.param({ filterData: filterField }), headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(onSuccess, onError);
// Returns the promise - Contains result once request completes
return true;
};
this works with me.
Nivedita_Parihar 17-Oct-14 5:29am    
Ok :)
hemant malpote 20-Oct-14 3:33am    
Thanks for your solution
Nivedita_Parihar 10-Feb-15 5:11am    
Welcome
There are different way to call ajax in angularjs

JavaScript
var ResponseObj = $http.get("/home/Index");
ResponseObj.success(function (data) { });

$http.post(),
$http.put(), 
$http.post(), 
$http.delete()
$http.head()


It might help you [different way]
 
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