작업 할 진행률 막대를 얻으려는 양식이 있습니다. 이 양식은 joomla에 있으며 파일 업로드시기를 표시하는 Ajax 진행 표시 줄을 얻을 수있었습니다. 그러나 양식의 일반적인 습관은 양식을 제출할 때 양식이 연관된 항목 페이지로 이동하고 해당 페이지에 확인 된 내용이 저장되었음을 알려주는 것입니다.Ajax 양식 진행 리디렉션
그러나이 새로운 Ajax 진행 막대를 사용하면 막대가 100 %로 표시되고 방화 광구를 보면 POST와 GET 모두 성공했지만 문제는 브라우저가 원본 페이지로 리디렉션하지 않고 양식 페이지에 남아 있다는 것입니다. 동일한 GET URL?
은 다음 코드의 일부가 될 때 다음 custom.js
$(document).ready(function()
{
$('#item_file').change(function(){
$('#submit').removeAttr('disabled');
});
$('#submit').change(function(){
$('#progress').removeClass('hide');
});
var options = {
beforeSend: function()
{
$("#progress").show();
//clear everything
$("#bar").width('0%');
$("#message").html("");
$("#percent").html("0%");
},
uploadProgress: function(event, position, total, percentComplete)
{
$("#bar").width(percentComplete+'%');
$("#percent").html(percentComplete+'%');
},
success: function()
{
$("#bar").width('100%');
$("#percent").html('100%');
},
complete: function(response)
{
$("#message").html("<font color='green'>"+response.responseText+"</font>");
},
complete: function()
{
},
error: function()
{
}
};
$("#idForm").ajaxForm(options);
});
에서 다음
JHTML::_('behavior.mootools');
JHTML::_('behavior.formvalidation');
$document =& JFactory::getDocument();
$document->addScript('components/com_component/assets/validate.js');
$document->addScript('jquery-1.7.js');
$document->addScript('jquery.form.js');
$document->addScript('custom.js');
<form action="index.php" method="post" name="nameForm" id="idForm" enctype="multipart/form-data" class="form-validate">
<input type="file" name="item_file" id="item_file"/></td>
기본 동작 또는 리디렉션 그래서 나는 custom.js에 추가 할 수있는 일이 있나요 업로드 진행률 표시 줄이 완료되면 계속됩니다.
감사합니다.
* font * 요소를 사용하셨습니까? 예. – epascarello
성공하면 페이지를 리디렉션 하시겠습니까? 그러므로 성공 또는 완료 메소드에서 window.location.href를 설정하십시오. – epascarello