Is chrome flagging all calls to servers without SSL - google-chrome

I am using geonames.org to auto populate my address fields based on zip code. I have been using there api and it was woking recently when I saw the following error:
net::ERR_NAME_NOT_RESOLVED
This is the bit of code i'm using to make the api call:
$.getJSON("https://www.api.geonames.org/postalCodeLookupJSON?postalcode=" + zip[0] + "&country=" + country + "&username=myUsername", function(response) {
//code for my view
$(".locked").attr("readonly", false);
var places = response.postalcodes;
if (places.length > 1){
$.each(places, function(i, place) {
$('#rightSideZip').append('<li class="zipLookups" data-city="' + place.placeName + '" data-zip="' + place.postalcode + '" data-state="' + place.adminCode1 + '"><span>' + place.postalcode + ' – ' + place.placeName + '</span><p>' + place.adminName1 + '</p></li>')});
} else {
city.val(response.postalcodes[0].placeName).blur();
state.val(response.postalcodes[0].adminCode1).blur();
lat.val(response.postalcodes[0].lat).blur();;
lng.val(response.postalcodes[0].lng).blur();;
latitude = response.postalcodes[0].lat;
longitude = response.postalcodes[0].lng;
}
});
});
Can I just not use this api anymore until they get the certificate or is there a way around it?

Related

Google Apps Script cache stopped working today

I used Google Apps Script Cache's putAll() for 21600 seconds. It has been working for months today just stopped working - all get from cache return null. The script reads a .csv file with about 90K entries, remove unwanted chars then caches using putAll() method. I tested the same file with the same script in my Dev's project it works fine. So somehow it does not work in my Production project. The code exactly the same, below:
My production's project id: Vendor Retainer GAS - project-id-5629958634838222671
There is no errors reported.
function cacheVendorList() {
var dataFilesFolder = DriveApp.getFolderById(dataFileFolderId);
var fileIt = dataFilesFolder.getFilesByName("VendorFile.csv");
if (fileIt != null && fileIt.hasNext()) {
var vendorFile = fileIt.next();
var keyValueStr = "{" + vendorFile.getAs(MimeType.PLAIN_TEXT).getDataAsString().
replace(/SAP,NAME,CMPY,CURRENCY/,'99,Test').
replace(/[^a-zA-Z0-9 ,\n]/g,' ').
replace(/$/mg,'",').
replace(/^\d+,/mg,
function(x) {
return '"' + x.substring(0,x.length-1) + '": "';
}).
replace(/D ",\n",$/,'D "') + "}";
//dataFilesFolder.createFile("VendorFile.txt", keyValueStr, MimeType.PLAIN_TEXT);
//Logger.log(keyValueStr);
var keyValObj = eval("(" + keyValueStr + ")");
// create a new vendor cache
vendorCache.putAll(keyValObj, 21600); // 21600 cache it for 6 hours
Logger.log("0000010100: " + vendorCache.get("0000010100"));
Logger.log("0090000435: " + vendorCache.get("0090000435"));
Logger.log("Got it");
}
}

Google Maps and Fusion Tables

A map I created last year using Google Maps API V3 and Fusion Tables V1 has stopped functioning properly in the last week or so. I am not sure if I missed an update that has deprecated my code or if there's another explanation. In brief, the following code queries my fusion table and if a match is found it returns data for an info window. However, it is now returning false every time. The addInfoWindow() function is firing fine. The issue appears to be either in the query itself or the data that's returned. Additionally, the pin is dropping in the correct location on the map so the coordinates are not the issue.
This issue can be replicated by entering an address in the field. For demonstration purposes, 9132 Kingston Pike 37923 should return true. Clicking inside any polygon will return the intended results.
Thank you for any guidance you can provide.
// query
var script = document.createElement('script');
var url = ['https://www.googleapis.com/fusiontables/v1/query?'];
url.push('sql=');
var query = "SELECT * FROM " +
tableid + " WHERE ST_INTERSECTS(geometry, CIRCLE(LATLNG(" + coordinate.lat() + "," + coordinate.lng() + "), 0.001))";
var encodedQuery = encodeURIComponent(query);
url.push(encodedQuery);
url.push('&callback=addInfoWindow');
url.push('&key=' + apiKey);
script.src = url.join('');
var head = document.getElementsByTagName('head')[0];
head.appendChild(script);
// call back function
function addInfoWindow(data) {
infowindow.close();
initialize();
var rows = data['rows'];
if (rows)
{
console.log("inside if statement");
for (var i = 0; i < 1; i++)
{
console.log("inside for loop: " + rows[i][0]);
infowindow.setContent("<div style='width:250px;'><h2>"+ rows[i][1] + "</h2><p>The neighborhood contact in your area would love to hear from you! </p><p>Click <a href='https://cspctystn.infellowship.com/GroupSearch/ShowGroup/" + rows[i][0] + "' target='_blank'>here</a> to get their information.</p><p> </p><p>If you desire to communicate with Community Life staff, contact -- removed --.<p><br/><br/></div>");
//console.log(rows[i][1] + ": " + rows[i][0]);
infowindow.setPosition(coordinate);
map.setCenter(coordinate);
map.setZoom(15);
infowindow.open(map);
}
}
else
{
console.log("error");
infowindow.setContent("<div style='width:250px;'><h2>Oops!</h1><p> It seems we don't have a neighborhood contact in your area.</p><p>Please communicate with our <a href='http://www.cspc.net/communitylife' target= '_blank' >Community Life</a> staff for more information. -- removed --<p></div>");
infowindow.setPosition(coordinate);
map.setCenter(coordinate);
map.setZoom(15);
infowindow.open(map);
}
}

Replace JSON values

It is my first time talking about JSON and I need some help (sorry if I make some mistake).
I have datas in the MySql database with strange values (ex. è - à - ù - ò.....) and when I have back the response from JSON my field result null.
Follow you can see the code I'm using!
Could somebody help me how to replace this letters or fixing the problem.
THANK YOU!
I get my datas phrased
{"items":
{
"id":"305",
"title":"Il manipolatore",
"description":null
}
....
}
This is my code:
var serviceURL = "app/testE/services/";
var employees;
$('#employeeListPage').bind('pageinit', function(event) {
getEmployeeList();
});
function getEmployeeList() {
$.getJSON(serviceURL + 'getemployees.php', function(data) {
$('#employeeList li').remove();
employees = data.items;
$.each(employees, function(index, employee) {
$('#employeeList').append('<li><a href="employeedetails.html?id=' + employee.id + '">' + '<img src="' + employee.img + '" width="80px" height="80px" />' +
'<h4>' + employee.title + '</h4>' +
'<p>' + employee.description + '</p>' +
'</a></li>');
});
$('#employeeList').listview('refresh');
});
}
Use $.ajax() rather than $.getJSON() and then set the charset to utf-8.
http://api.jquery.com/jQuery.ajax/

Pass parameter to another page to generate listview from Json

Hello I'm using this js to pass the url parameter and it's working just fine, but my problem is that when I define the path to the JSON file I don't want to use the id of the item...I want to use another Id. For example: I have the following item:
{"id":"1",
"name":"Winery",
"street":"Chile",
"number":"898",
"phone":"4204040",
"mail":"winery#hotmail.com",
"web":"www.winery.com",
"lat":"-32.891638",
"long":"-68.846522",
"id_localidad":"1",
"id_provincia":"1"}
I want to put id_localidad at the end of the path, to generate the listview depending on the city (id_localidad is the id of the city where the shop is), not the id of the item. And this is not working for me.
Thanks in advance!
JS FILE
$('#PuntosDeVenta').live('pageshow',function(event){
var id = getUrlVars()["id"];
$.getJSON('http://localhost/CavaOnline/json_PuntosDeVentas.php?id_localidad='+id, function(vinerias) {
//THIS IS NOT WORKING, IS THE SAME AS PUTTING id, not id_localidad
$.each(vinerias, function(index, vineria) {
$('#listviewVinerias').append( '<li><a href="FichaTecnicaVineria.php?id=' + vineria[id - 1].id + '" > ' +
'<img src="pics/' + vineria[id - 1].img_url1 + '"/>' +
'<h4>' + vineria[id - 1].name+'</h4>' +
'<p>' + vineria[id - 1].street+ ' ' + vineria[id - 1].number+ '</p>' +
'</a></li>');
$('#listviewVinerias').listview('refresh')
});
});
});
function getUrlVars() {
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
Div where I load the List
<div data-role="content">
<ul id="listviewVinerias" data-role="listview"></ul>
</div>
So I'm assuming your vinerias is a variable containing a list of JSON objects, even though I don't know why you are calling [id-1] everywhere.
If so, you can use the .filter() function to filter out the elements that have an id_localidad equal to the one specified.
var filteredVinerias = vinerias.filter(function(index){
return this["id_localidad"] === "1" //The localidad you want
});

Update jqGrid table with the results of Fusion Tables query in a Google Maps v3 page

I am looking to understand how to update a jqGrid table from Fusion Tables (FT) -
at the moment I can search or scroll on a Google Map, send an event listener that compiles a FT query of the spatial bounds of the viewport/map, to get a new set of results.
I want to use the new FT query string (or could use the Google code to retrieve the data - query.send(getData);) to update the jqGrid table with the new values.
Before I started using jqGrid, I tried/suceeded with the Google Visualisation API, and some of that code is below. Could anyone suggest how to move from table.draw, to loading/reloading a jqGrid table? Thanks a lot in advance.
function tilesLoaded() {
google.maps.event.clearListeners(map, 'tilesloaded');
google.maps.event.addListener(map, 'zoom_changed', getSpatialQuery);
google.maps.event.addListener(map, 'dragend', getSpatialQuery);
getSpatialQuery();
}
function getSpatialQuery() {
sw = map.getBounds().getSouthWest();
ne = map.getBounds().getNorthEast();
var spatialQuery = "ST_INTERSECTS(latitude, RECTANGLE(LATLNG(" + sw.lat() + "," + sw.lng() + "), LATLNG(" + ne.lat() + "," + ne.lng() + ")))";
changeDataTable(spatialQuery);
}
function changeDataTable(spatialQuery) {
var whereClause = "";
if(spatialQuery) {
whereClause = " WHERE " + spatialQuery;
}
var queryText = encodeURIComponent("SELECT 'latitude', 'longitude', 'name' FROM xxxxxxxx" + whereClause + " LIMIT 50");
var query = new google.visualization.Query('http://www.google.com/fusiontables/gvizdata?tq=' + queryText);
query.send(getData);
}
function getData(response) {
var table = new google.visualization.Table(document.getElementById('visualization'));
table.draw(response.getDataTable(), {showRowNumber: true});
}
Oh, and I used Oleg's code jqGrid returns blank cells as a basis for just seeing if I could get a simple multi-select table to pull data from my FT - that worked fine with the simple mod of
url: 'http://www.google.com/fusiontables/api/query?sql=' +
In case this helps someone, I've taken some of the code I came up with and pasted it below:
// You can get the map bounds via then pass it via a function (below is hacked from several functions
sw = map.getBounds().getSouthWest();
ne = map.getBounds().getNorthEast();
var whereClause = "ST_INTERSECTS(latitude, RECTANGLE(LATLNG(" + sw.lat() + "," + sw.lng() + "), LATLNG(" + ne.lat() + "," + ne.lng() + ")))";
//construct the URL to get the JSON
var queryUrlHead = 'http://www.google.com/fusiontables/api/query?sql=';
var queryUrlTail = '&jsonCallback=?'; //
var queryOrderBy = ' ORDER BY \'name\' ASC';
var queryMain = "SELECT * FROM " + tableid + whereClause + queryOrderBy + " LIMIT 100";
var queryurl = encodeURI(queryUrlHead + queryMain + queryUrlTail);
//use the constructed URL to update the jqGrid table - this is the part that I didn't know in my above question
$("#gridTable").setGridParam({url:queryurl});
$("#gridTable").jqGrid('setGridParam',{datatype:'jsonp'}).trigger('reloadGrid');