Answer the question
In order to leave comments, you need to log in
How to convert Prototype to jQuery?
Guys, please help me to convert Prototype to jQuery.
Or advise documentation or a site where it can be made.
document.observe('dom:loaded', function(){
var loadButton = $('upload_button');
var loadButtonValue = $F(loadButton);
new AjaxUpload(loadButton, {
name: 'photos[]',
multiple: true,
debud: true,
action: './ajax.php?module=<?=$this->module_id?>&action=10',
data: {
issue: '<?=$issue?>'
},
onSubmit : function(file, ext){
loadButton.value = 'Загружается...';
this.disable();
if (!(ext && /^(jpg|png|jpeg|gif)$/i.test(ext))){
alert('Error: неверный формат файла изображения.');
return false;
}
},
onComplete: function(file, response){
loadButton.value = loadButtonValue;
this.enable();
if(response.length) alert(response);
new Ajax.Request("./ajax.php?module=<?=$this->module_id?>&action=4", {
method: "post",
parameters: { issue: '<?=$issue?>' },
onSuccess: function(transport){
$('photosPhotosAll').update(transport.responseText);
photosLoadContent.defer();
}
});
}
});
photosLoadContent();
});
Answer the question
In order to leave comments, you need to log in
dom:loaded -> $(document).ready(function () {...});
new Ajax.Request -> $.ajax
And anyway, replace the file upload with this plugin: Dropzone.js
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question