I have a file called 'test.php' inside the file i have the following code
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#btn").click(function(){
jQuery.ajax({
url : 'http://example.com/TEST/images.php',
type : 'POST',
data : {
name : 'black-ring1.gif'
},
success : function(data, status) {
if(data){
alert(data);
}
}
});
});
});
</script>
</head>
<body>
<p id="btn">Button</p>
</body>
</html>
My 'images.php' file which executes when ajax called conteains the following code.
<?php
$image_name = $_POST['name'];
$src = "http://example.com/images/icons/" . $image_name;
if(file_exists($src)){
echo "Exists";
}else{
echo "Does not exist";
}
inside the 'images.php' file_exists($url) gives me always wrong answer(Does not exist).. I am sure $url really exits in the given url.. But why it does not work. How i can make it work ... Please help me.. Thanks..