SyntaxError: missing ; before statement

112 views
Skip to first unread message

Steven Ottz

unread,
Dec 11, 2015, 7:56:50 AM12/11/15
to AngularJS
I am trying to get an api cross browser using jsonp. This was working fine, now all of a sudden I get this error SyntaxError: missing ; before statement

It gets the request using firefox in the network dev tools as 200 but it's returning it to the console log to show this SyntaxError: missing ; before statement

I can't understand it..pls help


$http.jsonp(url)
   .success(function(response){
       console.log(response.data);
});

Sander Elias

unread,
Dec 14, 2015, 1:06:47 AM12/14/15
to AngularJS
Hi Steven,

The snippet you posted looks ok. Probably the error is originating from somewhere else. Sometimes sourcemaps gets skewed. that might throw you off.

Regards
Sander 

Hetal Thakkar

unread,
Feb 22, 2017, 9:26:55 AM2/22/17
to Angular and AngularJS discussion
i am also suffer the same problem and my code is like:

          $http({
        method: 'JSONP',
        url: 'http://localhost:8089/projects/?viewType=thumbnails&count=50&contentType=Projects&page=1'
        // params : {callback : 'JSON_CALLBACK'}
    }).
    success(function(status) {
        console.log("Response Success",status);
        //your code when success
    }).
    error(function(status) {
         console.log("Response Fails...",status);
    });

Hetal Thakkar

unread,
Feb 22, 2017, 9:26:55 AM2/22/17
to Angular and AngularJS discussion
i have also the same problem ,i was try everything .i didn't get the solution ,
please help me,  
   this is my code for remove the CORS error:

    $http({
        method: 'JSONP',
        url: 'http://localhost:8089/projects/?viewType=thumbnails&count=50&contentType=Projects&page=1'
        // params : {callback : 'JSON_CALLBACK'}
    }).
    success(function(status) {
        console.log("Response Success",status);
        //your code when success
    }).
    error(function(status) {
         console.log("Response Fails...",status);
    });

On Friday, December 11, 2015 at 6:26:50 PM UTC+5:30, Steven Ottz wrote:

Sander Elias

unread,
Feb 22, 2017, 10:04:47 AM2/22/17
to Angular and AngularJS discussion
@Steven, @Hetal,

I'm not sure wich version on AngualrJS you are using, but the .success and the .error methods of $http are deprecated for a long time already. When you switch over to .then, doe the error go away?

Regards
Sander
Reply all
Reply to author
Forward
0 new messages