Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5981151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:54:13+00:00 2026-05-22T21:54:13+00:00

I have decided i’d like to do an ambitious mood change depending on the

  • 0

I have decided i’d like to do an ambitious mood change depending on the time of day. I need to get the time and compare it against the sunset and sunrise of any given day.

So far I have found some javascript here that works well. Can anyone tell me how I might give the lat and long to the PHP function date_sunset? I have the IP in a PHP variable using $_SERVER['REMOTE_ADDR'] but that’s all I have. I can’t really do much else as I have never used the function and never tried to combine PHP and JS. Any ideas?

— Update —

I have been trying to use the jQuery $.ajax function. Here is my code;

<script language="JavaScript">
var lat = geoip_latitude();
var long = geoip_longitude();
$(document).ready(function(){
   //var url = 'http://www.ransomedesign.co.uk/web/?lat=' + lat + '&long='+ long;
   // $.get(url);
  $.ajax({
  type: "GET",
  data: { lat:lat, long:long},
  url: "http:www.ransomedesign.co.uk/web/",
  success: function() { alert("you win"); }
  })
});
</script>

There are two different approaches in there. (1st one is commented out). This does populate my $_SERVER php code, but only on the 2nd request of a page for my site. I really need this to process on the first visit before anything loads. After this the value will be stored in a session and php will do the rest.

Can anyone see whats wrong with this code or why it wont work straight away? My php if after this, is that correct?

Many thanks…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T21:54:14+00:00Added an answer on May 22, 2026 at 9:54 pm

    This question had no answer as such, I ended up getting a PHP module and .dat file installed on my hosting for me. The AJAX did work, but only after a page from my site had been visited – which was no use sadly. Thanks for the help everyone..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have decided that I really need to get some flowcharts for reverse engineering
I have decided that all my WPF pages need to register a routed event.
We have decided that it is time to ditch the ad-hoc method of deploying
I have decided to take up f# as my functional language. My problem: Give
I've been developing a site using ASP.NET MVC, and have decided to use the
Hey peoples, I've been studying Java for a couple of weeks, and have decided
I have some commits that I've decided, after the fact, are going to be
I've recently decided that I just have to finally learn C/C++, and there is
I have a largish Mercurial repository that I've decided would be better as several
I decided to teach myself assembly language. I have realized that my program will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.