Welcome Guest, Not a member yet? Register   Sign In
Display updated data without page refresh
#1

[eluser]Imman Kant[/eluser]
I'm doing a testimonial section, which I have placed in my footer file. As shown below. I know it's bland and all as of now.

The idea is to show the testimonials, as in, when a person enters a testimonial. And the admin approves it( which I have set in the admin control ), then only the testimonial will be displayed on the main page footer. What I have managed so far, is to get the testimonials as static. I want the testimonials whatsoever entered to be updated automatically from the one's as approved. I'm a newbie, please help me in regards.

As in, the page shouldn't refresh, but the entered testimonial text should be displayed when someone enters it, and it's been accepted by the admin. Like, it should stay there for 5 seconds, and then the next update shows, and so on.

#2

[eluser]jairoh_[/eluser]
u can use ajax there.
#3

[eluser]Imman Kant[/eluser]
I had an idea, but I still am not sure. Can you give a hint or example? Like, I know Ajax is used to fetch data, and without refreshing you fetch the data, but this isn't like a dropdown, right? I'm not sure, but I'm a complete noob, please bear with me on this. Thanks.
#4

[eluser]jairoh_[/eluser]
you mean many testimonials or only one?
#5

[eluser]Imman Kant[/eluser]
Many, as I have assigned a select form field(corresponds to it's field in database). If the admin approves, then the testimonial will be displayed. Do you want to see what I have done so far? Like the code snippet or similar?
#6

[eluser]jairoh_[/eluser]
you do something like this using ajax and jquery, you can do this ajax call every set of seconds or every mousemove

Code:
$.ajax({
           type: "POST",
           url: "", //function in the controller here
           data: data, //data u want to pass could be optional though or a set
           success: function ( e ) {
                      $( '#container' ).html( e );  //in your controller should return an html pre-formatted text that you would append or replace    in the container of your testimony
           }
});


i hope you get my concept sir.




Theme © iAndrew 2016 - Forum software by © MyBB