DIV refresh
Re: DIV refresh
Unless you ask a specific question instead of just saying "how can I make this work ?" there is no way I can help.
Re: DIV refresh
well i mean.. how do i go about showing the data and auto refresh for the check every x seconds via ajax or javascript? is that better :\
I would put a signature.. BUT, i don't have the time.
Re: DIV refresh
you can use setInterval
setInterval(function () { alert('this will be shown every second.'); }, 1000);
Re: DIV refresh
yeah but i want it to show the content of the php file.. so could i use $('div').show();
and how do i load the php file ...
and how do i load the php file ...
I would put a signature.. BUT, i don't have the time.
Re: DIV refresh
This goes back to my original point that you should use AJAX to transfer the data only not "show a php file" or "refresh a div"
Re: DIV refresh
okay so where do i go from here considering i know nothing about AJAX
I would put a signature.. BUT, i don't have the time.
Re: DIV refresh
Have a go at transferring an array from a php script to JavaScript via AJAX. TIP: http://php.net/json_encodeashwood wrote:okay so where do i go from here considering i know nothing about AJAX
Re: DIV refresh
i am having a hard time understanding that json thing.. im going to forget the shoutbox for now im going to start a freeware of my Music Board.. then work on a paid for version.. so yeah for now im okay with this :/
I would put a signature.. BUT, i don't have the time.
Re: DIV refresh
Okay. To explain json a bit anyway. It is a really easy way of transferring an array from a php script to javascript.
if In php you do
but now if you make an ajax request for this page from JavaScript you can just eval() the response to get the data out.
if In php you do
$things = array( 'first_thing' => 124, 'other_thing' => 12 ); echo json_encode($things);You will see a slightly weird looking string, this is actually javascript code, it defines an object (you dont have to worry too much abotu this).
but now if you make an ajax request for this page from JavaScript you can just eval() the response to get the data out.
ajax.get('the_above_file.php', function (resp) { var things = eval(resp); });Which then gives you an object that has the properties matching the array keys, ie
ajax.get('the_above_file.php', function (resp) { var things = eval(resp); alert(things.first_thing); alert(things.other_thing); });would alert "124" and then "12".