PHP shows newest comment from mysql without refreshing the page. - php

I want to reach a function like twitter. When people add a comment in my site anywhere. The newest information will display in one part of my home page. And upload the information without refresh the home page. I think it could be done by ajax, but I am a newbie, can anyone give me a live demo? or introduce me some plugin?

This is a good start for jquery: http://jqueryfordesigners.com/simple-jquery-spy-effect/
Then your ajax call will simply need to get the latest comments from your database. Probably by timestamp or datetime

There is a good example and study material for ajax
http://www.w3schools.com/Ajax/ajax_example.asp

Related

Database+Tooltip like wowhead

I´m searching a solution for this:
I want to have a series of pages where the information is provided on a single page like you see it here: http://www.wowhead.com/quest=12141
I want to have the information, which is on the page I've made, in a tooltip. Wowhead does it like this: http://www.wowhead.com/tooltips
I've tried the following:
I've made a MySQL database with my information in it and I'm able to print them out on the site.
Here is my problem. How do I get the informations inside of a tooltip. I can print them out with "php echo", but this would be a bit too complicated for general users to click on and wait for a page load to see them.
Summary: I need an easy solution to print out the information on a web site inside of a tooltip.
I hope you have any tips for me...
You can print all the content at once and show the tooltips using js without ajax requests.
I might misunderstood you and if yes - you should take some ajax tutorial

Hide Javascript file from Analytics

I apologize ahead of time for the non descriptive title, as I wasn't really sure how to word this.
I've currently switched some of my Wordpress sites that have a responsive design that implement a slider over to WooSlider. Works super well, and I love it. However, there is something stopping me from switching all of my sites over. And I understand this is not a WooSlider only fault, but it's something I cannot Google and find out.
This is happening on every page view, even those without a slider.
In Google Analytics it shows domain.com/?wooslider-javascript=load&t=1352743207&ver=1.0.0 as a page view. For every single page. I obviously don't want this, but I don't know how to get rid of it.
Another example of this happening is using Gravity Forms with a referrer info plugin that shows page views, search query, browser, etc.
When the form is sent, the following is sent via email.
Page visited 1: domain.com/?wooslider-javascript=load&t=1352743207&ver=1.0.0 (http://domain.com/?wooslider-javascript=load&t=1352743207&ver=1.0.0)
Page visited 2: domain.com/about (http://domain.com/contact/about/
Page visited 3: domain.com/?wooslider-javascript=load&t=1352751787&ver=1.0.0 (http://domain.com/?wooslider-javascript=load&t=1352751787&ver=1.0.0)
Page visited 4: domain.com/contact/ (http://domain.com/contact/)
So obviously I don't want that js file to show up as a page view. How can I remedy this?
Thanks!
Google Analytics Configuration Mistake #2: Query String Variables
wooslider-javascript,t,ver

How can I use the Jquery fadein/fadeout without reloading the page?

I need to create a website with an audio player that plays as users traverse through the site. At the same time, the content section needs to fade out and back in while this is still going on. So bring in another piece of HTML without reloading the page. The question I have is, how can i get all those to run correctly, while at the same time, running different Jquery plugins on different pages?
Essentially, I need to website to run like this one but with a continuous audio player in the corner or something.
http://www.chalicerecording.com/
If you notice, the page never reloads and the name of the actual file doesnt display on the browser top. This gives me the idea thats its using PHP for the page.
So with that idea, I ended up finding this.
http://www.youtube.com/watch?v=ytKc0QsVRY4
The problem im having with that is that I cant seem to figure out a way to run individual Jquery plugins on each individual PHP page without reloading the entire page. I hope this is enough info for you guys to work with.
you will need to use ajax calls to do so
jQuery.ajax
jQuery.post
jQuery.get
you also need to use jQuery fadeIn , jQuery fadeOut

Twitter type load data from database

So basically I need something similar that twitter has - when user scrolls down to the bottom of the page, new information from database automatically loads. Any suggestions how to create it or any examples? I know it can be done with AJAX, but could you please show a example, or a sample code?
It is called Infinite Scrolling (or Endless Scrolling). I think the most widespread solution is using Paul Irish's Infinite Scroll jQuery plugin. Also, you can find related information, documentation and demos in the Infinite Scroll page.

problem with ajax( page refresh)

hi im using ajax to extract all the pages into the main page but am not being able to control the refresh , if somebody refreshes the page returns back to the main page can anybody give me any solutions , i would really appreciate the help...
you could add anchor (#something) to your URL and change it to something you can decode to some particular page state on every ajax event.
then in body.onload check the anchor and decode it to some state.
back button (at least in firefox) will be working alright too. if you want back button to work in ie6, you should add some iframe magic.
check various javascript libraries designed to support back button or history in ajax environment - this is probably what you really need. for example, jQuery history plugin
You can rewrite the current url so it gives pointers to where the user was - see Facebook for examples of this.
I always store the 'current' state in PHP session.
So, user can refresh at any time and page will still be the same.
if somebody refreshes the page returns back to the main page can anybody give me any solutions
This is a feature, not a bug in the browser. You need to change the URL for different pages. Nothing is worse then websites that use any kind of magic either on the client side or the server side which causes a bunch of completely different pages to use the same URL. Why? How the heck am I gonna link to a specific page? What if I like something and want to copy & paste the URL into an IM window?
In other words, consider the use cases. What constitutes a "page"? For example, if you have a website for stock quotes--should each stock have a unique URL? Yes. Should you have a unique URL for every variation you can make to the graph (i.e. logarithmic vs linear, etc)? Depends--if you dont, at least provide a "share this" like google maps does so you can have some kind of URL that you can share.
That all said, I agree with the suggestion to mess with the #anchor and parse it out. Probably the most elegant solution.

Categories