Answer the question
In order to leave comments, you need to log in
How to set global http header handler from server in angular?
In yii there is such a thing for handling redirects on the side of browsers during ajax requests.
$(document).ajaxComplete(function (event, xhr, settings) {
var url = xhr.getResponseHeader('X-Redirect');
if (url) {
window.location = url;
}
});
Answer the question
In order to leave comments, you need to log in
firstly, not in Yii but in jQuery.
Secondly, we read the documentation for the $http service and, in particular, the interceptor section .
Third, use everything global carefully and only if you know what you're doing. Otherwise, it's better to make your own wrapper over $http and resolve everything there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question