on 02-07-2017 12:59 PM
Code is something like this:
var url = 'https://www.google.com/?q=video&wt=json&json.wrf=callback=getJSON'; $.ajax({ url : url, jsonpCallback : 'getJSON', contentType : "application/json", dataType : 'jsonp', success : function(data, textStatus, jqXHR) { alert("Happy"); online = "true"; }, error: function(e) { alert("Sad"); alert(e); online = "false"; } });
I am getting a exception as below:
uncaught SyntaxError: Unexpected token <
Anyone can please help me out
The response from your url is actually an HTML and that's the reason you are running into Syntax errors.
You need to check your api end point. It doesn't seem right.
If you are just trying out things, please feel free to use some open sourced API end points. One such example below.
var url = 'http://freegeoip.net/json/github.com';
BTW, this is not related to SAP UI5.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.