Skip to content

Simple ajax library which will handle connection during upload/download huge files

License

Notifications You must be signed in to change notification settings

Marbulinek/ajax-timeout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

License: MIT

ajax-timeout

Simple ajax library which will handle ajax call if the internet is slow or data are huge. Just prepare api call, set timeout value and enjoy :)

Settings

Setting function
type "POST" or "GET"
data {} - object containing data to upload to server
timeout time during which wont be call interrupted
logEnabled true / false
browserTimeout browser timeout while processing call at backend
onSuccess callback function
onError callback function

Example

Example of api call with slow Internet.

var settings = {
  type: "POST",
  url: 'page.com/myEndPoint4Upload',
  data: { file: hugeData },
  timeout: 120000, // 2 minutes timeout
  onSuccess: function (data) {
    console.log("some success information and do another logic with data returned from server");
  },
  onError: function (data){
    console.log("log the errors");
  }
}
// send prepared ajax call
$.ajaxTimeout(settings);

About

Simple ajax library which will handle connection during upload/download huge files

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published