$http Error can not method success of null


#1

$http.get(mainurl)
.success(function(data, status, headers, config) {
alert(‘Inside Success’);
}).
error(function(data, status, headers, config) {
alert(‘Inside Failure’);

      }); 

When this is executed generates an error as Error can not method success of null. What is wrong in it


#2

If I understood your question correctly, you are saying the http.get fails?
There could be many reasons:

  1. The url is malformed
  2. You are running it in your desktop browser and CORS is not allowing your request to succeed (search for cors in this forum)
  3. You are using HTTPS and you have certificate issues

You need to post more details