I want to use foreach on data that is returned from my another function: I am using below:
function getAllCompetitors() {
console.log('In getAllCompetitors function js file');
return $.ajax({
url: '/salescrm/getAllCompetitors',
type: 'POST',
success: function(data) {
console.log('getAllCompetitors data: ',data);
//response(data);
return data;
},
error: function(error) {
console.log('data error: ',error);
}
});
}
Below is my foreach:
getAllCompetitors.foreach(function(item){
})
Its showing error.
I want, to use foreach on data that is returned from function. Can anybody assist me to solve this.
Thanks in advance.