У меня есть функция javascript / jquery в веб-приложении с поддержкой автономного режима, которая прекрасно работает в Chrome 11, но после Chrome 12 перестала работать.Не обращайте внимания на другие браузеры, но заставить работать это в более поздних версиях Chrome становится все более и более критически важным.массив JSON, который перебирается, вставляя элементы ответа в локальную базу данных SQLite.
Журнал консоли не вызывает никаких флагов и ошибок javascript.Я вижу JSON в ответе, и единственная часть, которая кажется сломанной, - вставка данных, найденная в блоке try.
Кто-нибудь знает, было ли изменение в Chrome после версии 11, которое помешало бы взаимодействию с базой данных SQLite?Любая помощь будет наиболее ценной.
function importAssignmentData()
{
var import_count = 0;
$.get("data.php", function(data) {
if (data instanceof Array){
// Data is properly formed as an array.
}
else{
alert('Data from the server was not properly formed. You may not be logged in.');
}
$.each(data, function(index, value) {
if (this.order_id == 'authfail'){
alert("You are not logged into the server. Authentication failure.");
console.log("Authentication failure.");
}
else{
if (typeof this.order_id != 'undefined') { // sanity check
import_count++;
var EMPTY = "";
var order_id = (this.order_id == '') ? EMPTY : this.order_id;
var order_code = (this.order_code == '') ? EMPTY : this.order_code;
var customer_id = (this.customer_id == '') ? EMPTY : this.customer_id;
var customer_name_first = (this.customer_name_first == '') ? EMPTY : this.customer_name_first;
var customer_name_last = (this.customer_name_last == '') ? EMPTY : this.customer_name_last;
var customer_phone = (this.customer_phone == '') ? EMPTY : this.customer_phone;
var customer_email = (this.customer_email == '') ? EMPTY : this.customer_email;
var customer_address = (this.customer_address == '') ? EMPTY : this.customer_address;
var customer_city = (this.customer_city == '') ? EMPTY : this.customer_city;
var customer_state = (this.customer_state == '') ? EMPTY : this.customer_state;
var customer_zip = (this.customer_zip == '') ? EMPTY : this.customer_zip;
var order_notes_contractor = (this.order_notes_contractor == '') ? EMPTY : this.order_notes_contractor;
var measurement_date = (this.measurement_date == '') ? EMPTY : this.measurement_date;
try {
ODATA.transaction(function (transaction, results){transaction.executeSql("INSERT INTO order_specs (order_id, order_code, customer_id, customer_name_first, customer_name_last, customer_phone, customer_email, customer_address, customer_city, customer_state, customer_zip, order_notes_contractor, measurement_date) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", [order_id, order_code, customer_id, customer_name_first, customer_name_last, customer_phone, customer_email, customer_address, customer_city, customer_state, customer_zip, order_notes_contractor, measurement_date], nullDataHandler, errorHandler);});
console.log("Order record inserted.");
}
catch(e) {
console.log(e.message);
}
}
else {
alert('You are not online, or you may not be logged in properly.');
console.log("Offline attempt to retrieve remote data. No inserts made.");
} // end sanity check
} // end authfail check
}); // end .each
var plural = (import_count == 1) ? "" : "s" ;
alert('You have ' + import_count + ' active assignment' + plural + '.\nClick List Assignments to view your assignments.');
$('#reload_page').focus();
});
}