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

  • SEARCH
  • Home
  • 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 to change a search from using LIKE '%' + @searchTerm +
I have decided that I really need to get some flowcharts for reverse engineering
We have decided that it is time to ditch the ad-hoc method of deploying
I have decided that all my WPF pages need to register a routed event.
Finally I have decided to get rid of aptana from eclipse but the Software
I have decided to start developing a little web application in my spare time
UPDATE: I've spent way too much time on this and have decided to ditch
I have decided to get the user to enter DDMMYYY to get their birthday.
I have decided it was about time for me to learn how to make
I have decided to get back into flash development, and when I last left

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.