Better error management
This commit is contained in:
parent
154d1520fb
commit
6e54577167
@ -98,26 +98,30 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
|||||||
$("input#search_'.$htmlname.'").autocomplete({
|
$("input#search_'.$htmlname.'").autocomplete({
|
||||||
source: function( request, response ) {
|
source: function( request, response ) {
|
||||||
$.get("'.$url.($urloption?'?'.$urloption:'').'", { '.$htmlname.': request.term }, function(data){
|
$.get("'.$url.($urloption?'?'.$urloption:'').'", { '.$htmlname.': request.term }, function(data){
|
||||||
response($.map( data, function( item ) {
|
if (data != null)
|
||||||
if (autoselect == 1 && data.length == 1) {
|
{
|
||||||
$("#search_'.$htmlname.'").val(item.value);
|
response($.map( data, function(item) {
|
||||||
$("#'.$htmlname.'").val(item.key).trigger("change");
|
if (autoselect == 1 && data.length == 1) {
|
||||||
}
|
$("#search_'.$htmlname.'").val(item.value);
|
||||||
var label = item.label.toString();
|
$("#'.$htmlname.'").val(item.key).trigger("change");
|
||||||
var update = {};
|
}
|
||||||
if (options.update) {
|
var label = item.label.toString();
|
||||||
$.each(options.update, function(key, value) {
|
var update = {};
|
||||||
update[key] = item[value];
|
if (options.update) {
|
||||||
});
|
$.each(options.update, function(key, value) {
|
||||||
}
|
update[key] = item[value];
|
||||||
var textarea = {};
|
});
|
||||||
if (options.update_textarea) {
|
}
|
||||||
$.each(options.update_textarea, function(key, value) {
|
var textarea = {};
|
||||||
textarea[key] = item[value];
|
if (options.update_textarea) {
|
||||||
});
|
$.each(options.update_textarea, function(key, value) {
|
||||||
}
|
textarea[key] = item[value];
|
||||||
return { label: label, value: item.value, id: item.key, update: update, textarea: textarea, disabled: item.disabled }
|
});
|
||||||
}));
|
}
|
||||||
|
return { label: label, value: item.value, id: item.key, update: update, textarea: textarea, disabled: item.disabled }
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
else console.error("Error: Ajax url '.$url.($urloption?'?'.$urloption:'').' has returned an empty page. Should be an empty json array.");
|
||||||
}, "json");
|
}, "json");
|
||||||
},
|
},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/product/ajax/products.php
|
* \file htdocs/product/ajax/company.php
|
||||||
* \brief File to return Ajax response on product list request
|
* \brief File to return Ajax response on product list request
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user