Giter Club home page Giter Club logo

jquery-spa's Introduction

jQuery+hash设计单页面应用

新增页面:

1.在router.js中的routes中加入该page对象,如

{
    hash: "detail",
    name: "detail",
    title: "详情"
}

2.创建与上述对象中hash同名的html、js、css文件,并放到相应正确的文件夹中

具体写法参考detail相关html、js、css文件

使用组件:

//插入组件
<div class="Sider">
    <script  src="components/Sider/Sider.js"></script>
</div>

注意:容器的要加上以组件名称命名的class

AJAX请求:

$.ajax(ajaxSetting(options))

需要传入的options参数:

options: {
   url: string,
   type: string, //'GET'|'POST'|'PUT'|'DELETE'        (default: 'GET'),
   data: object // 无论是哪种请求方式,都是以data进行传参,
   success: function //请求成功后的回调函数
}

请求错误已进行捕获处理,无需传入错误回调

jquery-spa's People

Contributors

echogithu avatar

Watchers

James Cloos avatar  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.