• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
loading bar

#4
Hi,

I meet difficulty now.
I have below code. It seems it cannot work with your suggested code. Do I have any missing??
// --------- My Code ----------Without Loading bar---------------------------------
In controller call, in the function , $this->load->view('category.php', $data);
It only works with
document.getElementById("myForm").action="<?php echo base_url().MY_PATH; ?>getAll/1/".concat(catID).concat('/').concat(activeTab);
document.getElementById("myForm").submit();
// -----------Use your suggested code------With Loading Bar---------------------
// ---------Loading bar show but it seems the URL has problem after click a href. As the controller is loading view and without return success or any other thing // such as json response.......

In controller call, in the function , $this->load->view('category.php', $data);

In view page, <a id="newAds1" name="newAds1" href="#newAds" onclick="return setupTab('newAds', 'newAds1');"><?php echo $lblConditionNew;?>

In javascript ,
function setupTab(activeTab, activeCtrl){
var catID=document.getElementById("search-category").value;
$('#pleaseWaitDialog').modal('show');

setForm(function(data)
{
if(data == true)
{
$.ajax({
xhr: function()
{
var xhr = new window.XMLHttpRequest();
//Upload progress
xhr.upload.addEventListener("progress", function(evt){
if (evt.lengthComputable) {
var percentComplete = evt.loaded / evt.total*100;
//Do something with upload progress
$("#upload-progress-bar").width(percentComplete+"%");
console.log(percentComplete);
}
}, false);
return xhr;
},
url: "<?php echo base_url().MY_PATH; ?>getAll/1/".concat(catID).concat('/').concat(activeTab),
//data: formData,
processData: false,
contentType: false,
type: 'POST',
success:function(msg){
$("#".concat(activeCtrl)).attr("href", "<?php echo base_url().MY_PATH; ?>getAll/1/".concat(catID).concat('/').concat(activeTab));
$('#progress-bar').css("display", "none");
$('#pleaseWaitDialog').modal('hide');
}
});
}
return data;
});


}
Reply


Messages In This Thread
loading bar - by rchiu5hk - 02-08-2016, 01:35 AM
RE: loading bar - by Diederik - 02-08-2016, 02:44 AM
RE: loading bar - by rchiu5hk - 02-08-2016, 02:47 AM
RE: loading bar - by rchiu5hk - 02-08-2016, 07:01 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.