Hey. Basically it's just:
success: function(msg){
alert(msg);
}
What comes out alert´s. But is it possible for me if i have a var in the file that the ajax call:
$filename = time() . "10";
to use in success?
So i could do
success: function(msg){
alert($filename);
}
(now its not correct) but how can i do this?
$.ajax({
type: "POST",
url:"functions.php?action=crop",
data: {x: $('#x').val(),y: $('#y').val(),w: $('#w').val(),h: $('#h').val(),fname:$('#fname').val(),fixed:fixed,size:size},
success: function(msg){
if(!fixed)
$("#crop_preview").css({overflow:"auto"})
$("#crop_preview").html($(document.createElement("img")).attr("src", msg.filename)).show();
$("#crop_preview").after("Here is your Cropped Image :)").show();
$("#image").slideUp();
}
});
And php:
$time = time().".jpg";
echo '(';
echo json_encode(array(
'filename'=>$time
));
echo ')';