Current location: Hot Scripts Forums » Programming Languages » PHP » Date updating of a calendar with PHP and AJAX.


Date updating of a calendar with PHP and AJAX.

Reply
  #1 (permalink)  
Old 11-01-07, 06:44 PM
miniature miniature is offline
Newbie Coder
 
Join Date: Feb 2006
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
Date updating of a calendar with PHP and AJAX.

Title.......^
This is the code:

calendar.php: (the calendar..)
PHP Code:

$time time();

 
$today getdate($time);
$mday $today['mday'];
$mon $today['mon'];   
$year $today['year'];
echo 
"<a href='javascript:;' onclick='javascript:ajax_calendar();'>שנה קודמת</a>\n"

A JS code with the AJAX:
HTML Code:
function ajax_support() {
  try {
    // Firefox, Opera 8.0+, Safari
    return new XMLHttpRequest();
  }
  catch(e) {
    // Internet Explorer
    try {
      return new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(e) {
      try {
        return new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch(e) {
        alert("Your browser does not support AJAX!");
        return false;
      }
    }
  }
}
function ajax_calendar() {
  var ajax_cal = ajax_support();
  ajax_cal.onreadystatechange=function() {
    if((ajax_cal.readyState == 4) && (ajax_cal.status == 200)) {
      return ajax_cal.responseText;
    }
  }
  ajax_cal.open("GET","calendar_ajax.php",true);
  ajax_cal.send(null);
}
calendar_ajax.php:
PHP Code:

<?php

  $time_ajax 
time();
 
  
$today_ajax getdate($time_ajax);
  
$mday_ajax $today_ajax['mday'];
  
$mon_ajax $today_ajax['mon'];   
  
$year_ajax $today_ajax['year'];  
  
$time mktime(000$mon_ajax,$mday_ajax,$year_ajax-1);
?>
It's not working and nothing is happen.
I want it define in calendar.php the variable $time like it returned from calendar_ajax.php .
Moreover, I am searching for a way that I would transfer information from calendar.php to calendar_ajax.php so that it will be the real date that transfered and not a time() .

I'm sure there is a lot of mistakes in the code because it's the first time that I am trying to use AJAX.


Thank you,
Reply With Quote
  #2 (permalink)  
Old 11-02-07, 12:31 AM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
I really don't understand what you are trying to do.

Can you please try to explain it a little better?
__________________
Jerry Broughton
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
For Hire: Looking for Php, Mysql, Asp, Ajax work (4 years exp.) t_narendra Job Offers & Assistance 2 01-29-07 03:06 PM
[For Hire] Php, Mysql ASP, AJAX programmer t_narendra Job Offers & Assistance 0 11-29-06 06:08 AM
AJAX problem with php dynamic url scott2500uk PHP 3 10-28-06 10:33 AM
[For Hire] Php, Mysql, ASP, AJAX, DHTML programmer t_narendra Job Offers & Assistance 0 09-01-06 01:25 AM
need Java script ( Ajax) Calendar, tree, grid curtisannev Job Offers & Assistance 1 10-30-05 08:59 PM


All times are GMT -5. The time now is 07:31 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.