I have a big issue with $.ajax. I try to send a file name to the PHP part (in the same file), to help me stocking that name in a $_SESSION. It worked perfectly yesterday, but not anymore. Is there a browser issue instead of code issue ? Here is my code :
JS function
<script type="text/javascript" charset="utf-8">
function no_select(){
var images = $("#selected_images").text();
if(images != ''){
var tmpFile = $("#selected_images").text();
var arrayFile = tmpFile.split(",");
if (arrayFile.length > 2){
alert("Il ne faut selectionner qu'un seul badge !");
return false;
}
var value = $.ajax({
type: "GET",
dataType: "json",
url: "overview_list.php",
data: "selectedImage="+arrayFile[0],
async: false,
success: function()
{
return true;
}
});
return true;
} else if(images == ''){
alert("Il faut selectionner un badge");
return false;
}
}
</script>
PHP
<?php
if(!empty($_GET['selectedImage'])){
$let = $_GET['selectedImage'];
} else {
$let = "";
}
$_SESSION['selectedImage'] = $let;
?>
I have already check a lot of solutions around the web, but there was no solution for me.
It should be like
$.ajax({
type: "GET",
dataType: "json",
url: "overview_list.php",
data: {selectedImage:arrayFile[0]},
async: false,
success: function()
{
return true;
}
and makesure arrayFile[0] is getting value