Should I use PHP or Javascript for page refreshing? [closed] - javascript

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I would like to ask for your opinion on the topic. I can make my page refresh with both of these methods, but I do not know if they have any drawbacks. So, which one should I use?
Edit:
I'm talking about header('Refresh:0') in PHP and location.reload() in javascript.(Sorry, I forgot them first)

The draw back with doing this via JavaScript is that you are limiting this feature to users who do not have JavaScript running in their browser. If it's important that the page refresh for all users then I would suggest not doing it via JavaScript.
Doing it via PHP would run for all users, but the bigger question is why do you need to refresh the page? And could you achieve the same thing without refreshing the page?

Related

Is it bad practice to combine PHP and HTML? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
This may be a small question, but I haven't found any direct answer yet. Is it considered bad practice to use PHP alongside HTML? (using PHP foreach for example in combination of with HTML)
I have searched on Google and I didn't find a direct answer. Another example: What should I do when an user logs in on a website. Do I store the important information with $_SESSION (PHP) or should I store it with sessionStorage(Javascript)?
1) HTML and PHP go hand in hand, and unless you know one of the two languages ​​you have to use them together
2) you should save the information with the $ _SESSION of php and destroy them every time a user logs-out

Website posting and login [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
How can I make website where the moderator will be able to publish a post or an image without accessing to the code. To publish something like a facebook status from some part of site. And second question, who can I make that someone can login to my site(moderator/administrator), I know how to make login form but just visualy withaout some functionality. Thanks
(I know HTML, CSS, JavaScript)
You seem to be talking about a Content Management System. I'd suggest you look at some of the (many) options out there
e.g. Wordpress or Drupal - neither is perfect but both are widely supported.

How often should AJAX reload specific content on the page? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I'm constructing an app where users can insert their preferences in a table. It is possible to load an updated version of the table via AJAX. I would like to load these updated versions from time to time, so the users will see almost always the newest version of the table, without reloading the page by themself. My questions regarding that are:
How often should the browser of the user request via AJAX a new version of the table?
Is that a bad approach? Maybe users want to reload the page manually.
Thank you for any answer in advance. Let me know how I can improve my question.
You should probably do it anywhere between 5 and 15 seconds. It's not a bad approach, and you can add a "refresh" button for manual refreshing. If your server is shared or there's lots of traffic, you can increase the duration to 30 seconds.
Note: This answer is based on my experience with web apps and previously built applications and web sites. There are no set standards for this behaviour.

How to transfer JavaScript variables to PHP [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I've got a problem. I don't know how to transfer JS variables to PHP.
In JS I've got my main script and I'm using PHP only to file management but I need some variables from JS.
The short answer is AJAX, (or SOAP but you better go with AJAX). So go do a little research on it, and if you know jQuery or Prototype or something similar, you are pretty much off for starting to code in a new technology in minutes.
Here are some links, to get you started:
How to start learning Ajax?
http://api.jquery.com/jquery.ajax/

Javascript tool/website for sharing scripts and developing [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm looking for a website/service were I can develop and share my Javascript code with others. I had a site open in browser the other which did it nicely, but after searching my history and googling around for half an hour, I can't find anything.
The site I saw was split into four areas: html, css, javascript and result..
Anybody know a site like that?
JSFiddle is what you're looking for.
http://jsfiddle.net
JSFiddle
Note that at times when JSFiddle is slow, you might want to use JSBin.

Categories

Resources