Giter Site home page Giter Site logo

io's Introduction

Ajax API

  • 执行基本ajax请求, 返回XMLHttpRequest

      IO.ajax(url, {
      	async      是否异步 true(默认)
      	method     请求方式 POST or GET(默认)
      	type       数据格式 json(默认) or xml, text
      	encode     请求的编码 UTF-8(默认)
      	timeout    请求超时时间 0(默认)
      	credential 跨域请求时是否带证书(默认false,不带http认证信息如cookie)
      	data       请求参数 (字符串或json)
      	scope      成功回调执行上下文
      	success    请求成功后响应函数 参数为text,json,xml数据
      	failure    请求失败后响应函数 参数为xmlHttp, msg, exp
      })
      
  • 也可只传一个配置对象

      IO.ajax({
      	url        请求
      	async      是否异步 true(默认)
      	method     请求方式 POST or GET(默认)
      	...
      })
      
  • 执行ajax请求, 返回纯文本

      IO.text(url, {
      	...
      })
      
  • 执行ajax请求, 返回JSON

      IO.json(url, {
      	...
      })
      
  • 执行ajax请求, 返回XML

      IO.xml(url, {
      	...
      })
      
  • GET 请求

      IO.get(url, {
      	...
      })
      
  • POST 请求

      IO.post(url, {
      	...
      })
      
  • 同步请求

      IO.sync(url, {
      	...
      })
      
  • 异步请求

      IO.async(url, {
      	...
      })
      
  • 还有更简便的,总有一种满足您

      IO.get(url)
      IO.get(url, success)
      IO.get(url, data, success)
      
      IO.post(url)
      IO.post(url, success)
      IO.post(url, data, success)
      
      IO.sync(url)
      IO.sync(url, success)
      IO.sync(url, data, success)
      

JSONP API

  • 基本的JSONP请求

      IO.jsonp(url, {
      	param     // 请求参数 (键值对字符串或js对象)
      	success   // 请求成功回调函数
      	failure   // 请求失败回调函数
      	scope     // 回调函数执行上下文
      	timestamp // 是否加时间戳
      	jsonpCallback // 指定回调函数名称,不使用随机函数名,用在缓存时,此时timestamp应该设为false
      })
      
  • 也可只传一个配置对象

      IO.jsonp({
      	url       // 请求url 
      	param     // 请求参数 (键值对字符串或js对象)
      	success   // 请求成功回调函数
      	...
      })
      
  • 还有更简便的,总有一种满足您

      IO.jsonp(url)
      IO.jsonp(url, success)
      IO.jsonp(url, data, success)
      

io's People

Contributors

zhouyrt avatar snandy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.