I’m using this function on a jquery script:
function recogerEventos(id) {
var respuesta = $.ajax( {
type: 'GET',
url: 'eventos.php',
data: 'cmd=recoge&id='+id,
success: function(data) {
//alert(data);
return data;
},
error : function () {
return false;
}
}).responseText;
//alert("asdfksjfhajk"+respuesta);
return respuesta;
}
If I uncomment the alert(data) it shows the return string value, but when I uncomment the alert(“asdffksd…”) it shows only the random letters and no more, I need to send this ‘respuesta’ value to get string in other document.
If someone know how to get it, please, explain me, i’m desperate
Thanks to all, Carlos
An alternative is to set the
asyncoption to false, which allows you to return the data directly from the call toajax. eg.The downside to this approach is that it will block the browser whilst it waits for the request to complete.