Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promise Jsonp #50

Open
hsipeng opened this issue Jun 4, 2018 · 0 comments
Open

Promise Jsonp #50

hsipeng opened this issue Jun 4, 2018 · 0 comments

Comments

@hsipeng
Copy link
Owner

hsipeng commented Jun 4, 2018

promise 和 jsonp 结合

依赖包

  • fetch-jsonp
fetchJsonp(url, {
	josnpCallback: 'jsonpCallback'
})
.then(function(response){
	return response.json()
})
.then(function(json){
	console.log('success:' + json)
}).catch(function(ex){
	console.log('error:' + ex)
})
  • jsonp
jsonp(url, {
	param: 'jsonpCallback'
},function(err, data) {
	if(err){
		console.log('error')
	}else {
		console.log(data)
	}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant