54 lines
1.3 KiB
JavaScript
Executable File
54 lines
1.3 KiB
JavaScript
Executable File
function AddMaterial(){
|
|
|
|
CheckMaterials();
|
|
|
|
$("type").value = "addMaterial";
|
|
|
|
new Ajax.Request(WEB_ROOT+'/ajax/productos-materiales.php',{
|
|
method:'post',
|
|
parameters: $('frmAgregarProducto').serialize(),
|
|
onLoading: function(){
|
|
$("materiales").innerHTML = LOADER;
|
|
},
|
|
onSuccess: function(transport){
|
|
var response = transport.responseText || "no response text";
|
|
var splitResponse = response.split("[#]");
|
|
|
|
$("materiales").innerHTML = '';
|
|
|
|
if(splitResponse[0] == "ok"){
|
|
$("materiales").innerHTML = splitResponse[1];
|
|
}
|
|
|
|
},
|
|
onFailure: function(){ alert('Something went wrong...') }
|
|
});
|
|
|
|
}
|
|
|
|
function DeleteMaterial(k){
|
|
|
|
$("type").value = "deleteMaterial";
|
|
$("k").value = k;
|
|
|
|
new Ajax.Request(WEB_ROOT+'/ajax/productos-materiales.php',{
|
|
method:'post',
|
|
parameters: $('frmAgregarProducto').serialize(),
|
|
onLoading: function(){
|
|
$("materiales").innerHTML = LOADER;
|
|
},
|
|
onSuccess: function(transport){
|
|
var response = transport.responseText || "no response text";
|
|
var splitResponse = response.split("[#]");
|
|
|
|
$("materiales").innerHTML = '';
|
|
|
|
if(splitResponse[0] == "ok"){
|
|
$("materiales").innerHTML = splitResponse[1];
|
|
}
|
|
|
|
},
|
|
onFailure: function(){ alert('Something went wrong...') }
|
|
});
|
|
|
|
} |