1 Star 0 Fork 0

ayhome / najaxjs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

MIT License

najaxjs - Ajax simple library

Features

  • najaxjs. Ajax simple library. You can use ajax easily and customize request & response behaviors.

  • Supported response-type is raw text / json / jsonp / html / script / csv / or others... And it has many ajax options, async / sync / retry / timeout / cache / or others by Nx object.

  • Cross-domain requests supported by $najax.scriptTag / $najax.jsonpTag.

  • There are various helper methods, $najax.url, $najax.query, $najax.submit. And $najax@helper, Singular, Pager, Reflector classes support 'ajax + ui'.

  • $najax.history can easily operate url-history(push / replace / listen).

  • Relay / Linker class. It can bundle responses.

Requirements

  • None. Any other library is unnecessary.
    (Only $najax.sendex method requires anyjs and jQuery library.)

Browser Support

  • Modern web-browsers(Chrome, IE, Firefox, Safari, Opera) support.
  • IE browser: Support IE9. Loose support in IE8. (You can use most of the functions.)
  • Legacy browser partially support.

Basic usage(code example)

// Ajax by $najax.request
$najax.request(url).done();
//
// Set request and response behaviors by Nx
$najax.request(url).type('text').timeout(5).retry(3).done();
$najax.csv(url).done();
$najax.sync(url).param('stone', 'age').done();
//
// It's possible to set success / fail / complete function
$najax.request(url).success(sccs).complete(cmp).done();
$najax.request(url).fail(fail).complete(cmp).done();
$najax.request(url).done(sccs);
//
//
// Others
// See tutorials.

Distributions

For detail, see reference. In dist directory,

Distribution Introduction
najax.js / najax.min.js Default version.
najax-tiny.js / najax-tiny.min.js Tiny version. Not include the below.

$najax.history
$najax.send / $najax.sendex
$najax.scriptTag / $najax.jsonpTag
$najax@class(Singular, Pager, Reflector)
najax-micro.js / najax-micro.min.js Micro version. Not include helper methods.
rlk.js / rlk.min.js Relay / Linker standalone version.

Ajax response type

See [Nx.type] for detail.

Type Description Value type
json(*) Json. assoc
raw Raw data. string
text Text. text is same as raw. string
html HTML. Element
script Execute script. null
func Function. function
jsonp Jsonp. null
csv Csv(Tsv). array
xml Xml. XMLDocument
blob Blob. Blob
other XMLHttpRequest.responseType. Varies.

Nx class specification

Nx class. This class is created automatically by $najax various method.

Specification

  • Specify ajax request and response behaviors by Nx object.
  • Specify by Nx object's various method or Nx opt method.
  • Begin ajax connection by Nx done.
  • Nx done returns Relay object.
  • Relay provide operating response-data, and bundling multiple Relay.
  • Nx implement ajax by using XMLHttpRequest.

Relation library(any-js series)

Library Introduction Requirements
anyjs Basic methods and UI helper library. jQuery library
najaxjs Simple ajax library. None
nviewjs View template engine. jQuery library / anyjs

License

Released under the MIT license. See LICENSE.

ChangeLog

See CHANGELOG.

The MIT License (MIT) Copyright (c) 2016 any-js Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
JavaScript 等 4 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/anyhome/najaxjs.git
git@gitee.com:anyhome/najaxjs.git
anyhome
najaxjs
najaxjs
master

搜索帮助