Jump to content

Javascript Redirect...


phpSensei

Recommended Posts

I personally prefer this method. Add this to the top of your document (assuming its PHP)

 

<?php
header("Refresh: 3; url=" . $_SERVER['HTTP_REFERER']);
?>

 

But if your document isn't php, this wont work without playing with the settings on your server.

 

Semicolons aren't necessary but its the proper and more efficient way in Javascript.

 

Got any links for that? Ive always been under the impression that they're unnecessary code and therefore should be left out.

 

 

Link to comment
Share on other sites

Thanks Yin, and the rest of you guys...

 

I used the meta refresh with the history.go(-1)

 

I am using Ajax, I got bored of PHP because it just seemed that I knew everything and done everything with it, so I decided to learn Ajax and I learned it in 1 week. Now I am trying to explore the functions and methods of Javascript to make my Ajax fancier, and use PHP without any page refreshes when integrated with Ajax. Its very cool actually, Its like PHP but without the page refresh and I whole lot more...

 

 

one thing I don't understand: Effect.SlideDown('element'), I cant get it to work, or maybe I don't know how to use it.

Link to comment
Share on other sites

I think you are misunderstanding how AJAX should be used. It shouldn't be used alone, it should be added over top of fully functioning PHP. Users wont necessarily have javascript turned on, and its sloppy programming to have a site that doesn't function properly if the user has it turned off. A true pro will make their site fully functional with or without javascript.

 

Ajax is great. But its an addition, not a base.

Link to comment
Share on other sites

I think you are misunderstanding how AJAX should be used. It shouldn't be used alone, it should be added over top of fully functioning PHP. Users wont necessarily have javascript turned on, and its sloppy programming to have a site that doesn't function properly if the user has it turned off. A true pro will make their site fully functional with or without javascript.

 

Ajax is great. But its an addition, not a base.

You know, a simple script can alert the user to check if the javascript is turned on or not. I do not use Ajax as the main porgramming language or as the base. I put it in small/sometimes big places like pagination, comments, chat,...etc

 

PHP is the base programming, Ajax just works behind the scenes to update data without pages refreshing all the time. I don't think I am misunderstanding ajax.

Link to comment
Share on other sites

If you are using it that way, then you are right, you aren't using it wrongly.

 

Although with good programming a message isn't needed to alert the user about javascript being necessary, javascript just isn't necessary in the first place.

 

The only real exceptions would be something like a chat program where it cant be done in php, or at least cant be done reasonably in php.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.