M
M
melickvadim2015-02-18 15:00:35
PHP
melickvadim, 2015-02-18 15:00:35

Jquery. IE does not see the value from $_SESSION. How to win?

Does not work in IE 9, 10, 11. Works in
FF and Chrome.

On the main page I set $_SESSION["step"] = 1
On the button I send $.post
After $.post the page is reloaded.

$.post('/', {catalog: 'setstep'}, function(e){
            window.location = e;
});

PHP sets $_SESSION["step"] = 2

Smarty draws hmtl based on $_SESSION["step"] value
{if $smarty.session.step == 1} 
<div id="1">1</div>
{else}
<div id="2">2</div>


Appears in browsers, remains in IE <div id=1>, and the value of $_SESSION["step"] == 2 (displayed via echo).
If you press the button a second time, IE will open page c <div id="2">
. Tried to send different headers, it doesn't help.
$.ajaxSetup({
    cache: false,
    dataType: 'text',
        contentType: "application/x-www-form-urlencoded; charset=utf-8"
  });

Answer the question

In order to leave comments, you need to log in

3 answer(s)
F
FanatPHP, 2015-02-18
@FanatPHP

If a reboot is made after the post, then what is the scary sense of making it a javascript?
Do it humanly, HTTP post - HTTP redirect - and everything will work for you.

M
melickvadim, 2015-02-18
@melickvadim

Apparently in order for the clock to spin on the screen until the result is returned. PHP has a lot going on at this time.

6
65536, 2015-02-18
@65536

session_write_close() add somewhere at the end of the script

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question