πŸ“¦ YMFE / cross-request

A chrome extension that gives the html page cross-domain request capability.

β˜… 295 stars β‘‚ 110 forks πŸ‘ 295 watching
cross-domain-request
πŸ“₯ Clone https://github.com/YMFE/cross-request.git
HTTPS git clone https://github.com/YMFE/cross-request.git
SSH git clone git@github.com:YMFE/cross-request.git
CLI gh repo clone YMFE/cross-request
苏文雄 苏文雄 Merge branch 'master' of github.com:YMFE/cross-request 1a41bb0 5 years ago πŸ“ History
πŸ“‚ master View all commits β†’
πŸ“„ .gitignore
πŸ“„ background.html
πŸ“„ background.js
πŸ“„ icon.png
πŸ“„ index.html
πŸ“„ index.js
πŸ“„ jquery-3.1.1.js
πŸ“„ manifest.json
πŸ“„ popup.html
πŸ“„ popup.js
πŸ“„ README.md
πŸ“„ response.js
πŸ“„ README.md

A chrome extension that gives the html page cross-domain request capability.

δΈ€δΈͺθ΅‹δΊˆhtmlι‘΅ι’θ·¨εŸŸθ―·ζ±‚θƒ½εŠ›ηš„chrome扩展

https://chrome.google.com/webstore/detail/cross-request/cmnlfmgbjmaciiopcgodlhpiklaghbok?hl=en-US

Api

crossRequest( options )

Usage

  • GET
crossRequest({
    url: 'http://caibaojian.com/ajax-jsonp.html',
    method: 'GET',
    success: function(res, header){

    }
})
  • POST
crossRequest({
        url: 'http://127.0.0.1:3000/api',
        method: 'POST',
        headers: {
            'Content-Type': 'application/json'
        },
        data: {
            a: 1,
            b: 2,
            c: {
                t: 1
            }
        },
        success: function (res) {
            console.log(arguments)
        }
    })
  • FILE upload
crossRequest({
        url: 'http://127.0.0.1:8081/upload',
        method: 'POST',
        data: {
            name: 'hello',
            id: '19'
        },
        files: {
            file: 'fileId' //File Upload-Input dom id
        },
        success: function (res) {
            alert(res)
        }
    })