I have this ajax function:
function GuardarJson(url,que,id,cod,param,respuesta) {
var Daticos = {id: id ,codigo: cod, respu: respuesta };
$.ajax({
url: "Paginas/"+url+"?que="+param,
data: Daticos,
type: "post",
dataType: 'json',
success: function(data) {
Alerta(data.alerta,data.Tipo,'');
data.script
},
error: function(xhr, status, error){ $().toastmessage('showToast', { text : 'Error '+ xhr.responseText, sticky : true, type : 'error' }); }
});
};
The fact is that from json I pass a series of data and one of them is script inside script I want to pass functions to execute variables according to which case.
How can I make that text that passed through json be executed as a function?
the format that I'm passing is this:
$Respuesta['script'] = "$(\"#MenuIdFactura_".$Que."\").val('".$IdNuevo."').change(); alert('Holiii');";
the variables of the answer are because it is inside a php function but when they run they arrive with the data well placed.