/    Sign up×
Community /Pin to ProfileBookmark

php with javascript?

Hi I am pulling items from a mysql database generally with php. Some told me if I connect javascript to php code that does that, then can pull it at any timings I want. But what would be the point of that when I can just put a
<meta http-equiv=”refresh” content=”30″> like for 30 seconds in a page or something, to choose the timing?

Also since it really isn’t doing anything different than the javascript to it, since a meta refresh does that same thing.

Also wouldn’t that be a bad idea connecting javascript to the php also, since mysql data must be pulled from a database with php anyway. I was told javascript cannot pull mysql data into a page only php can. Since php code is already in a page anyway, wouldn’t that also be a bad idea because then wouldn’t work for those with browser javascript disabled, if javascript is connect to the php for mysql.

Anyway I don’t know what the point is, can anyone tell me what advantage there is for timing, to connect javascript to php code that pulls items from a mysql database?? Please let me know thanks a lot to you.

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJun 20.2011 — An "AJAX" implementation of JavaScript plus a PHP script on the server called by that AJAX Javascript can allow you to only update part of the page without having to do a complete reload of the parts of the page that do not need to change. This means less information to transfer from the host to the browser on each such update, and the browser then only has to change the content of a specific portion of the page.

Whether or not it makes sense to do this in any specific case is for you to decide based on your particular circumstances and requirements.
Copy linkTweet thisAlerts:
@MichelllleauthorJun 20.2011 — It sounds like you're saying there really is no need to connect javascript or ajax to php and not sure why others would have told me that. Since a meta refresh does that also. Unless their use is for something else needed. Let me know if I got that wrong. Which is what I needed some others opinions on. Thanks a lot for replying.

Can you tell me though is it true mysql database info does need to be pulled out onto a web page with PHP like others told me it really does?
Copy linkTweet thisAlerts:
@NogDogJun 20.2011 — The difference is that the meta refresh reloads the entire page, whereas a JavaScript/AJAX call can just update one particular part of the page (e.g. a news headline listing, stock quotes, stuff like FaceBook does to show new message/comment indicators and show new posts in the middle column, and so on).

You don't [i]have[/i] to use AJAX, just like you don't [i]have[/i] to use meta refresh tags. You [i]should[/i] understand how each works, so that you can decide to use either tool (or not) for any given situation where it might be the right tool to use.
Copy linkTweet thisAlerts:
@MichelllleauthorJun 20.2011 — OK that must have been my missing puzzle piece. That must have been what others were hinting at so long that wasn't making any sense because there wasn't clear enough information. Thank you for letting me know why others were probably telling me that.
Copy linkTweet thisAlerts:
@miki1986Jun 21.2011 — We Are Wordpress Developer.

hire me at 5$ per hour.

my skype id is baakdaa.
×

Success!

Help @Michelllle spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...