All Projects → galeone → sa

galeone / sa

Licence: other
Simple Ajax: a lightweight library to make AJAX requests

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to sa

AjaxHandler
ASimple PHP Class to help handling Ajax Requests easily
Stars: ✭ 30 (+130.77%)
Mutual labels:  ajax-request, ajax
demo-chatroom
go+iris+jwt+mysql+xorm+viper,iris项目实战简易聊天室,登录、注册、私聊、群聊。
Stars: ✭ 47 (+261.54%)
Mutual labels:  ajax
Zl Fetch
A library that makes the Fetch API a breeze
Stars: ✭ 186 (+1330.77%)
Mutual labels:  ajax
Ajax Form
HTML forms on performance-enhancing drugs
Stars: ✭ 232 (+1684.62%)
Mutual labels:  ajax
Bliss
Blissful JavaScript
Stars: ✭ 2,352 (+17992.31%)
Mutual labels:  ajax
Django Bootstrap Modal Forms
A Django plugin for creating AJAX driven forms in Bootstrap modal.
Stars: ✭ 244 (+1776.92%)
Mutual labels:  ajax
Lajax
🚀 lajax - 前端日志解决方案。
Stars: ✭ 181 (+1292.31%)
Mutual labels:  ajax
Ajaxinate
🎡 Ajax pagination plugin for Shopify themes
Stars: ✭ 107 (+723.08%)
Mutual labels:  ajax
WebDAVAjax
WebDAV AJAX Library for opening docs from a web page and saving back directly to server in a SharePoint-like manner.
Stars: ✭ 16 (+23.08%)
Mutual labels:  ajax
Vue2 Autocomplete
Vue 2 Component to make Autocomplete element.
Stars: ✭ 227 (+1646.15%)
Mutual labels:  ajax
Bbs Ssm
南生论坛基于SSM框架,自适应手机端和电脑端,界面简洁美观,功能完善。演示地址:http://www.nanshengbbs.top
Stars: ✭ 221 (+1600%)
Mutual labels:  ajax
Ember Ajax
Service for making AJAX requests in Ember applications
Stars: ✭ 218 (+1576.92%)
Mutual labels:  ajax
Learn To Send Email Via Google Script Html No Server
📧 An Example of using an HTML form (e.g: "Contact Us" on a website) to send Email without a Backend Server (using a Google Script) perfect for static websites that need to collect data.
Stars: ✭ 2,718 (+20807.69%)
Mutual labels:  ajax
Wretch
A tiny wrapper built around fetch with an intuitive syntax. 🍬
Stars: ✭ 2,285 (+17476.92%)
Mutual labels:  ajax
proxrox
Proxy services, combine origins, use SSI and more during development
Stars: ✭ 43 (+230.77%)
Mutual labels:  ajax
Bs grid
Bootstrap Datagrid
Stars: ✭ 184 (+1315.38%)
Mutual labels:  ajax
Ajax Live Search
AJAX Live Search is a PHP search form that similar to Google Autocomplete feature displays the result as you type.
Stars: ✭ 238 (+1730.77%)
Mutual labels:  ajax
miniAjax
🚀A mini Ajax library provides Ajax, jsonp and ready features for simple web applications.
Stars: ✭ 67 (+415.38%)
Mutual labels:  ajax
EMAN
一个基于SSM框架与物品的协同过滤算法(ItemCF)的简单电子书推荐系统
Stars: ✭ 48 (+269.23%)
Mutual labels:  ajax
Job-Portal-Django
DJobPortal is a job posting site developed in Django. Where Employer can Register their Company profile, Login Then add Job Post. Employee can bookmark & apply for the Job. There is a dashboard section where Employer can check his job posting list & applicants details also can delete and update his job post. Employee can see his job bookmark lis…
Stars: ✭ 136 (+946.15%)
Mutual labels:  ajax

sa - Simple AJAX

The aim of sa is to provide a lightweight library to easy make AJAX requests.

Learning by examples

Instantiate the AJAX object

var ajax = null;
try {
  ajax = new AJAX();
} catch(e) {
  // handle error (XMLHttpRequest object not supported)
}

Instantiate the AJAX object for a CORS request

var ajax = null;
try {
  var CORS = true;
  ajax = new AJAX(CORS);
} catch(e) {
  // handle error (XMLHttpRequest object not supported)
}

GET request

ajax.get('/somepage?parmeter=wat&who=yello',function(data) {
  // handle completed get request
},
function(statusCode, body) { // Handle failure
  console.log(statusCode, body);
});

POST request

ajax.post('/somepage', function(data) {
  // Handle completed post request
}, function(statusCode, body) { // Handle failure

  console.log(statusCode, body);
}, parameters);

GET Request returning JSON

ajax.getJSON('/somepage?parmeter=wat&who=yello',function(data) {
  // Handle json return object, like:
  console.log(data.field1, data.field2);
}, function(statusCode, body) { // Handle failure
  console.log(statusCode, body);
});

Generic request

You can build your own request.

ajax.request({
url: '/wow',
  type: 'post',
  dataType: 'json',
  data: {wow: 'amazing', 'param2': 1},
  success: function(json) {
    alert(json.responseField2);
  },
  failure: function(statusCode, body) {
    alert("Request failed with status code: " + statusCode);
    alert("Request failed with body: " + body);
  }
});

In the example above we do a POST request to /wow and we expect to obtain a JSON object in respose.

We could specify JSON or XML for the expected format of the response. Empty field means HTML.

Parameters

As you can see from the examples, you can use JSON object or a literal string to pass parameters.

To specify other parameters in AJAX.request you have to follow the definition below.

//define generic ajax request parameter
{
  type: '',
  url: '',
  data: '',
  dataType: '',
  success: function(data){},
  failure: function(errorCode, body){}
};

With:

  • type = get|post
  • url = whatever you want
  • data: string|JSON
  • dataType: "JSON"|"XML"|""
  • success = function(data) {}
  • failure = function(errorCode, body) {}

License

sa is licensed under the terms of MIT licence.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].