Hello i want to read with the id file when user checked a checkbox.the id is the checkbox value and he from the database. I add the checkbox action in main.js but i don't know how to get the variable in index.php this the main.js
$(function () {
'use strict';
$( '.checkbox' ).on( "click", function(){
if ( $( this ).is( ':checked' ) ){
$( "#fileupload" ).data( "checkbox", this );
var checked_value = $( this ).val();
// alert(checked_value);
var arr = checked_value .split('-');
// alert(arr[0]);
var anomalie2 = arr[0],
missionID2 = $( "#missionID2" ).val();
//alert(missionID2);
// Initialize the jQuery File Upload widget:
$('#fileupload').fileupload({
// Uncomment the following to send cross-domain cookies:
//xhrFields: {withCredentials: true},
anomalie_id : anomalie2,
mission_id : missionID2,
url: 'server/php/'
});
// Enable iframe cross-domain access via redirect option:
$('#fileupload').fileupload(
'option',
'redirect',
window.location.href.replace(
/\/[^\/]*$/,
'/cors/result.html?%s'
)
);
if (window.location.hostname === 'blueimp.github.io') {
// Demo settings:
$('#fileupload').fileupload('option', {
url: '//jquery-file-upload.appspot.com/',
// Enable image resizing, except for Android and Opera,
// which actually support image resizing, but fail to
// send Blob objects via XHR requests:
disableImageResize: /Android(?!.*Chrome)|Opera/
.test(window.navigator.userAgent),
maxFileSize: 5000000,
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i
});
// Upload server status check for browsers with CORS support:
if ($.support.cors) {
$.ajax({
url: '//jquery-file-upload.appspot.com/',
type: 'HEAD'
}).fail(function () {
$('<div class="alert alert-danger"/>')
.text('Upload server currently unavailable - ' +
new Date())
.appendTo('#fileupload');
});
}
} else {
// Load existing files:
$('#fileupload').addClass('fileupload-processing');
$.ajax({
// Uncomment the following to send cross-domain cookies:
//xhrFields: {withCredentials: true},
url: $('#fileupload').fileupload('option', 'url'),
data: "IDmission="+mission_id+"&IDanomalie="+anomalie_id,
dataType: 'json',
context: $('#fileupload')[0]
}).always(function () {
$(this).removeClass('fileupload-processing');
}).done(function (result) {
$(this).fileupload('option', 'done')
.call(this, $.Event('done'), {result: result});
});
}
}
})
});
And this is the index.php... I just want to get the variable and use it to make the request.
Aucun commentaire:
Enregistrer un commentaire