djnicemobile Posted March 6, 2012 Share Posted March 6, 2012 Im new to PHP/JS ... I searched everywhere and the only answer Im getting is ajax... which I do not under stand at all! I have this Birthday (Javascript) Script.. which works... but I need the result from that birthday script to work with my PHP script.. here is the birthday.php <script language="JavaScript"> var arrBday = [ ['@user1','10/12/1984'], ['@user2','1/1/1900'], ['@user3','10/12/1984'], ['@user4','10/12/1984'], ]; function displayBdayList(today){ var bday,strList=''; for (var i=0;i<arrBday.length;i++){ bday = new Date(arrBday[i][1]); if (!isNaN(bday) && bday.getMonth()==today.getMonth() && bday.getDate()==today.getDate()) strList+=' '+arrBday[i][0]+" "; } if (strList=='') strList='- Nobody Has a Birthday Today' document.write("Happy Birthday: "+strList) } displayBdayList(new Date()); </script> The outcome will be "Happy Birthday: @user @user @user" I want that outcome to be sent to another PHP file to be used as a variable. But dont know how to use ajax at all.... Im aware that PHP works before Javascript... so is there anybody that can help me out with this? Would greatly appreciate it Quote Link to comment https://forums.phpfreaks.com/topic/258361-need-help-with-js-php/ Share on other sites More sharing options...
AyKay47 Posted March 6, 2012 Share Posted March 6, 2012 Well, I'm going to give the same answer. Ajax is what you are looking for. I recommend you look at the Jquery AJAX API Quote Link to comment https://forums.phpfreaks.com/topic/258361-need-help-with-js-php/#findComment-1324431 Share on other sites More sharing options...
djnicemobile Posted March 6, 2012 Author Share Posted March 6, 2012 I'm still pretty lost, I looked and looked into ajax so much last night it gave me a headache. I forgot to mention, I would be running this through cronjob if I ever get it working Quote Link to comment https://forums.phpfreaks.com/topic/258361-need-help-with-js-php/#findComment-1324464 Share on other sites More sharing options...
q11we Posted March 9, 2012 Share Posted March 9, 2012 Try learning XMLHttpRequest It is easier than learning ajax. Quote Link to comment https://forums.phpfreaks.com/topic/258361-need-help-with-js-php/#findComment-1325455 Share on other sites More sharing options...
AyKay47 Posted March 9, 2012 Share Posted March 9, 2012 Try learning XMLHttpRequest It is easier than learning ajax. you do realize that the basis of ajax is the use of this object right? Quote Link to comment https://forums.phpfreaks.com/topic/258361-need-help-with-js-php/#findComment-1325482 Share on other sites More sharing options...
cpd Posted March 11, 2012 Share Posted March 11, 2012 Try learning XMLHttpRequest It is easier than learning ajax. you do realize that the basis of ajax is the use of this object right? I thought exactly that when I read q11we's post. That made me chuckle. Quote Link to comment https://forums.phpfreaks.com/topic/258361-need-help-with-js-php/#findComment-1326131 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.