Skip to content

Commit c39f64c

Browse files
committed
Parse error response text
1 parent 3eabcd7 commit c39f64c

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

ipgeolocation.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function request (subUrl, callback, apiKey = "") {
5757
var urlParameters = "";
5858

5959
if(!subUrl) {
60-
callback({"status": 401, "message": "Given path to IP Geolocation API is not valid"});
60+
callback(JSON.parse("{'status': 401, message: 'Given path to IP Geolocation API is not valid'}"));
6161
return;
6262
}
6363

@@ -96,14 +96,14 @@ function request (subUrl, callback, apiKey = "") {
9696
url: "https://api.ipgeolocation.io/".concat(subUrl, urlParameters, ""),
9797
contentType: "application/json",
9898
dataType: "json",
99-
success: function (data, status, jqXHR) {
99+
success: function (result, status, xhr) {
100100
if (callback) {
101-
callback(data);
101+
callback(result);
102102
}
103103
},
104-
error: function (data, jqXHR, status) {
104+
error: function (xhr, status, error) {
105105
if (callback) {
106-
callback(data.responseText);
106+
callback(JSON.parse(xhr.responseText));
107107
}
108108
}
109109
});

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
"#USER",
1919
"/"
2020
],
21-
"_resolved": "https://registry.npmjs.org/ip-geolocation-api-jquery-sdk/-/ip-geolocation-api-jquery-sdk-1.0.5.tgz",
21+
"_resolved": "https://registry.npmjs.org/ip-geolocation-api-jquery-sdk/-/ip-geolocation-api-jquery-sdk-1.0.6.tgz",
2222
"_shasum": "7afe1f670ee1309eb9effb25818c481c5d855593",
2323
"_spec": "ip-geolocation-api-jquery-sdk",
2424
"_where": "/home/developer/jQry/npm",
2525
"author": "ipgeolocation",
2626
"bundleDependencies": false,
2727
"deprecated": false,
28-
"description": "JQuery SDK for [IP Geolocation API](https://ipgeolocation.io/). You can use this SDK to Geolocate an IP address and get time zone information based on geolocation coordinates, or an IP address.",
28+
"description": "[JQuery SDK for IP Geolocation API](https://ipgeolocation.io/documentation/ip-geolocation-api-jquery-sdk-201809051507). You can use this SDK to Geolocate an IP address and get time zone information based on geolocation coordinates, or an IP address.",
2929
"keywords": [
3030
"ip",
3131
"ipgeo",
@@ -46,7 +46,7 @@
4646
"scripts": {
4747
"test": "echo \"Error: no test specified\" && exit 1"
4848
},
49-
"version": "1.0.5",
49+
"version": "1.0.6",
5050
"repository": {
5151
"type": "git",
5252
"url": "git+https://github.com/IPGeolocation/ip-geolocation-api-jQuery-sdk.git"

0 commit comments

Comments
 (0)