EasyUI Forum
July 17, 2024, 02:37:27 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Reload whole page while loading data into TAB(smth happened, we have to do this)  (Read 17787 times)
mzeddd
Full Member
***
Posts: 223



View Profile
« on: August 16, 2012, 08:10:09 AM »

Hi,

There is a question.

For example I'm opening some page with TABs, fill in the form and press "next" to open new TAB with lets call it "results" and load content generated by my script (lets call it "script.php")
Due to some things on server (ex. session has expired) I have to reload the page completely.

I tried to call "header('Location: http://myhost');" PHP function in my script.php but it reload "http://myhost" inside my new "results" TAB.

How can I do what I wanted to have?

Thanks
Logged
anton.dutov
Newbie
*
Posts: 27


View Profile
« Reply #1 on: August 16, 2012, 05:59:03 PM »

If tabs loads by ajax try that
 
when session expires you would send code 403 Unauthorized (in script.php)

Globaly set:
Code:
$(function(){
 
  $.ajaxSetup({
    statusCode: {
      403: function() { location.assign('/auth/'); }
    }
  });

});
if ajax response returns 403 then javascript code redirect from curret page to page 'http://myhost.com/auth/'
or change location.assign('/auth/'); to location.assign('/'); to redirect to site root

Also i not recommend use redirect in scripts wich generates ajax content, some browsers follows redirect and loads content from there.
(like in you case)
By example

Without redirect

ajax.get('/somepage/')
  -> GET /somepage/ <- 200 OK, Content, Return content /somepage/


ajax.get('/somepage/')
  -> GET /somepage/ <- 302 Moved temprary, Location: /otherpage/ 
  -> GET /otherpage/ <- 200 OK, Content, Return content /otherpage/
                       
« Last Edit: August 16, 2012, 06:00:36 PM by anton.dutov » Logged
mzeddd
Full Member
***
Posts: 223



View Profile
« Reply #2 on: August 17, 2012, 12:42:49 AM »

Thanks Anton,

This is what I've been looking for.

//Valery
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!