Problem Statement: In my project I am using $http({ method : 'GET', url : data : ..... param, for get and Post it works fine. But when I use same method in fiddle it will block my request. If I use $http.get(.... then it will work in jsfiddle dont know why
Can any one explain me what is difference between $http.get('http://... and $http({mthod :'GET',....})
See these both example :
1) Example: https://jsfiddle.net/kevalbhatt18/84e02j4t/8/
var promise = $http({
            method : 'GET',
            url : 'http://d.yimg.com/autoc.finance.yahoo.com/autoc',
            data : entity,
            dataType: 'jsonp',
            jsonp: 'callback',
            jsonpCallback: 'YAHOO.Finance.SymbolSuggest.ssCallback',
            headers : {
                'Content-Type' : 'application/json'
            },
            cache : false
        }).then(function (response) {
            return response;
        });
ERROR : in first example see in console it will give you error.
XMLHttpRequest cannot load https://autoc.finance.yahoo.com/autoc. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://fiddle.jshell.net' is therefore not allowed access.
2) using $http.get(... Example: http://jsfiddle.net/kevalbhatt18/qny7v23f/
 test: function (param) {
            $http.get('http://d.yimg.com/autoc.finance.yahoo.com/autoc', {
                params: {
                    query: param,
                    callback: 'YAHOO.Finance.SymbolSuggest.ssCallback'
                }
            })
                .success(function (data, status, headers, config) {
                return data;
            })
                .error(function (data, status, headers, config) {
                return "there was an error";
            })
        }
    }
And I am using Cors app in chrome so it will add Access-Control-Allow-Origin'
 
     
    