How can I send these two variables into ajax, For using in upload.php page.
That's how I tried.
<?php
if (!isset($_GET['lcid']) || $_GET['lcid'] == NULL) {
echo "<script>window.location = 'insurt-documents.php';</script>";
} else {
$id = $_GET['lcid'];
}
?>
var error_images = '';
var form_data = new FormData();
var files = $('#multiple_files')[0].files;
if(files.length > 15)
{
error_images += 'You can not select more than 15 files';
}
else ............
But relevant code are...
var id = "<?php echo $id ?>";
$.ajax({
url:"upload.php",
// data: {id, form_data},
data: {id : id, form_data},
method:"POST",
contentType: false,
cache: false,
processData: false,
beforeSend:function(){
$('#error_multiple_files').html('<br /><label class="text-primary">Uploading...</label>');
},
success:function(data)
{
$('#error_multiple_files').html('<br /><label class="text-success">Uploaded</label>');
load_image_data();
}
});
Some code for upload.php
$id = $_POST['id'];
$query = "
INSERT INTO tbl_image (postid, image_name, image_description)
VALUES ('".$id."', '".$file_name."', '')
";
There are my works, But it doesn't run. Please Someone correct me. Thank You.