php - why do we need to place the source name to redirect? -


i saw in post (jquery ajax php redirecting page) when using ajax redirect php page need set event :

$.ajax({  type: "post",  url: "ajax.php",  data: datastring,  success: function(r)    {     window.location = 'new.php';//window.location.href = 'new.php';     //$("#div").html(r);   }, }); 

however it's not clear me :

  1. why need indicate " url: "ajax.php","
  2. should url entry contain name of current file we're redirecting ?
  3. if i'm redirecting file called abc.html ? should replace ajax.php abc.html ?

thanks!

let me explain

$.ajax({ type: "post", url: "ajax.php", data: datastring, success: function(r)  {    window.location = 'new.php';//window.location.href = 'new.php';    //$("#div").html(r); }, }); 

$.ajax function makes ajax request files ..

your questions

  1. why need indicate " url: "ajax.php","
  2. should url entry contain name of current file we're redirecting ?
  3. if i'm redirecting file called abc.html ? should replace ajax.php abc.html ?

answer #1

this line means url: ajax.php ... want make ajax request in case code making ajax request file ajax.php

answer #2

no totally separate redirecting ..

answer #3

no if change ajax.php abc.html not redirect..after changing make ajax request abc.html now

and redirecting ... use simple code

window.location.href = 'filename'; // replace filename file new.php 

Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -