I'm having some issues on how to use the data returned by jQuery's $.post function. I'm trying to test if a picture exists on my server or not.
Here is the javascript :
$.post("ajax_test_file.php",
{filename: filetocheck},
function(data){
if(data==1){
var img_ref_up = 'value 1';
}else{
var img_ref_up = 'value 1';
}
}
);
[Following code trying to use img_ref_up's value]
And here is the ajax_test_file.php content :
$filename = $_POST["filename"];
if (file_exists($filename)) {
echo 1;
} else {
echo 0;
}
What i'm trying to do is to use the value of img_ref_up right after the $.post(...)
Does anyone have a clue about this? Thanks in advance