JavaScript Ajax form upload progress bar ajax form upload file,ajax form upload image,ajax form

Trying to make a progress bar for a form upload (old HTML4 form upload, not new HTML5 API). The progress actually tracks additional work being done after the file has moved. The way it has been designed is that the stream stays opened until after the additional work is done, and then the server-side method finally returns, which closes the stream.

I'm having some issues that may be specific to Chrome. I do also have a working implementation, but I'm hoping to get something "better".

For anybody who is likely to ask for code: it's intentionally not here. The scenario explains the problem; the code itself wasn't "at fault" and will just be more clutter.

Failed attempt #1 in a nutshell

  1. Initiate form upload
  2. Set interval on an Ajax call that grabs the progress in some JSON
  3. Render the data to a progress bar

Reason for failure: the upload stream blocks other activity on the page, and you cannot make additional Ajax calls during the transfer.

Failed attempt #2 in a nutshell

  1. Create an iFrame which contains the same Ajax calls
  2. Render the data to an element within the iFrame (everything needed is self-contained and does not reference the "top" document in the least)

Result:

  • before initiating the form upload, I could render "status: waiting" from the JSON. The rendering function also incremented a counter so I would see "attempt #X". The # of attempts would increment while status is waiting.

  • after transfer initiated, the Ajax calls were successfully getting 200 and I could inspect the responses to see that the JSON was in fact there.

  • HOWEVER, I could not update the "shadow DOM" (is that the correct term?) in the iFrame. Attempts to access nodes within the iFrame and modify them failed. Even the counter did not increment.

  • When the transfer completed, it would then successfully render "status: complete" and the counter would jump ahead (the counter was incrementing, but rendering it to the iFrame just wasn't working)

GRR!

Successful Attempt

The iFrame does not request Ajax anymore. The iframe's src attribute is set to a URL that returns a pre-rendered progress bar. The document being loaded into the iframe is set to reload itself. So at the prescribed interval, it re-renders a new progress bar which has "moved along".

The result is a "working" progress bar, although sometimes the lag in the request causes the iframe to be blank for a split second, which isn't my preference.


Can anybody think of a better way to do this? Is it possible that I could have the form itself in the iFrame and the Ajax work in the "top" document instead?

I mainly want to divide the presentation layer from the data layer, but as long as I have to return a rendered progress bar, that isn't going to work. As a bonus, if I can find a way to update the progress bar via Ajax, I won't have those "blank" blips.

Answer:1

I decided to use: http://blueimp.github.io/jQuery-File-Upload/ because it is free and gives you nice progress bar.

Answer:2

So, I have this string, which can contain a number of any length really. 10 100 1000 10000 100000 I need a regex which makes the strings like this: 10 100 1 000 10 000 100 000 For 100000, I have ...

So, I have this string, which can contain a number of any length really. 10 100 1000 10000 100000 I need a regex which makes the strings like this: 10 100 1 000 10 000 100 000 For 100000, I have ...

  1. javascript make regex from string
  2. javascript make regex
  3. javascript make regex case insensitive
  4. javascript make regex with variable
  5. js make regex from string
  6. js make regex

I am using Google code prettify on a page (working correctly), and I want to add a function which is called once this process completes. In the docs, they describe the following parameter: callback=...

I am using Google code prettify on a page (working correctly), and I want to add a function which is called once this process completes. In the docs, they describe the following parameter: callback=...

  1. using callbacks with promises
  2. using with callbacks
  3. using callbacks in javascript
  4. using callbacks in keras
  5. using callbacks in node js
  6. using callbacks in react
  7. using callbacks in java
  8. using callbacks in python
  9. using callbacks in c#
  10. using callbacks in js
  11. using callbacks in typescript
  12. using callbacks in swift
  13. using callbacks in express
  14. using callbacks in labview
  15. using callbacks in r
  16. using callbacks in class
  17. using callbacks in ros
  18. using function with callbacks

I made this webservice that handles my database functions, and this is an AJAX call to one of the methods. $.ajax({ type: "POST", url: "Service/dataBaseService.asmx/getRMAData", ...

I made this webservice that handles my database functions, and this is an AJAX call to one of the methods. $.ajax({ type: "POST", url: "Service/dataBaseService.asmx/getRMAData", ...

  1. navigate json object javascript
  2. navigate json object
  3. navigate json object python
  4. navigate json object c#
  5. navigate json object in java
  6. navigate through json object java
  7. powershell navigate json object
  8. navigate through json object
  9. navigate through json object c#
  10. jquery navigate json object
  11. js navigate json object

I would like to know if it's possible to recreate the tile system of modern UI from Windows 8 on a HTML page. I already created this from this website. Here is the code <div class="tile pos1-1 ...

I would like to know if it's possible to recreate the tile system of modern UI from Windows 8 on a HTML page. I already created this from this website. Here is the code <div class="tile pos1-1 ...