-
Notifications
You must be signed in to change notification settings - Fork 34
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
ajax的跨域问题 #48
Comments
请问mmRequest有像jquery一样的设置headers的方法或者属性吗?有空能告知一下吗,貌似没在文档里看见啊。。。谢谢 |
jquery怎么设置,它就是怎么设置 |
擦汗。。。 正妹老师百忙中都回复了,为啥不明说。试了headers{}, requestHeaders{}, beforeSend时设置,貌似都不行。或者怎么取到原始xhr对象,我直接自己设置也好啊。您能看看吗? 感谢! |
avalon.ajax({/**/}).setResponseHeader("xx","yy")
avalon.get(a,b,c).setResponseHeader("xx","yy")
avalon.post(a,b,c).setResponseHeader("xx","yy") get, post, getJSON,ajax方法都会返回promise对象,上面有一个setResponseHeader方法 |
感谢回答。不过应该是发送请求前设置xhr.setRequestHeader(‘ ’, ‘ ’),应该怎么设置。有没有或者怎么实现像ng一样的$http服务,能全局拦截或者捕获所有的请求(来设置header或者处理回应的错误),对spa很有用。能提供个思路吗。以前真的很少前端注意header。。。 |
为什么不把ajax放到avalon.js里? 这是框架很基础的功能,为什么要分离开呢? |
因为很多时候是与JQ一起使用,直接用JQ的就行了 |
ths |
请问除了jsonp方式解决跨域问题之外,还有别的方式可以解决吗?mmrequest中有没有提供其他方式解决跨域问题
The text was updated successfully, but these errors were encountered: