0

the php code below is taken from a code that is called using ajax. Can anyone tell me what does the below code window.location.replace(response.path) do? What is response.path?

    ...
    // initialize the return array
        $return = array();
        $return['callback'] = 'window.location.replace(response.path);';
    ...
Bogota
  • 401
  • 4
  • 15
Chang Lin
  • 61
  • 8

1 Answers1

0

window.location.replace(response.path); is javascript code that replaces the current location by a response.path property that is set somewhere else in the javascript that runs this. It may for example be run in the success function of your ajax query object to redirect the user. Also if your PHP sets a $return['path'], that is probably what it is using but we don't have enough of the code to confirm.

Tom Tom
  • 3,680
  • 5
  • 35
  • 40