有数据ajax返回unf,javascript - jQuery get local time, then use AJAX to give to php - Stack Overflow...

I need my php file f-eval.php to receive the hour time from a javascript / jQuery file time.js through $_GET and AJAX, but it isn't working. My code is as follows.

f-eval.php

$totalflightscore = 100;

// Something is wrong weather

if (isset($_GET['drizzle'])) {

$totalflightscore = $totalflightscore - 10;

}

if (isset($_GET['rain'])) {

$totalflightscore = $totalflightscore - 30;

}

if (isset($_GET['thunder'])) {

$totalflightscore = $totalflightscore - 50;

// selecting this option alone will trigger a red alert.

}

// Something is wrong wind

if ($_GET['windspeed'] > 30) {

$totalflightscore = $totalflightscore - 50;

} elseif ($_GET['windspeed' > 15]) {

$totalflightscore = $totalflightscore - 25;

} elseif ($_GET['windspeed' > 10]) {

$totalflightscore = $totalflightscore - 5;

} else {

if ($_GET['windspeed'] <= 12) {

// wind speed is less than 12 mph. do nothing.

}

}

// Something is wrong day night

if (isset($_GET['am-day'])) {

// some users of this site may hold Part 107, so do not trigger a red alert.

} else {

$totalflightscore = $totalflightscore - 20;

}

// Something is wrong airmap

if (isset($_GET['am-green'])) {

$totalflightscore = $totalflightscore + 10;

// adding because green indicates there are no controlled airspace zones nearby

}

if (isset($_GET['am-orange'])) {

$totalflightscore = $totalflightscore - 25;

// indicates you are in airport 5 mile zone, near heliport, or near tfr.

}

if (isset($_GET['am-red'])) {

$totalflightscore = $totalflightscore - 75;

// indicates you are in an airport or on a runway, in tfr, or in controlled airspace. will trigger a red alert.

}

// reCaptcha code

echo "TFS was $totalflightscore";

if ($totalflightscore <= 40) {

echo '';

} elseif ($totalflightscore <=60) {

echo '';

} elseif ($totalflightscore <=100) {

/*echo ''; */

echo "This is executing!";

if ($_GET['n']) {

echo 'I am recieveing AJAX.';

}

}

index.html

SafeFlight

#content-wrapper {

margin-left: 5%;

margin-right: 5%;

margin-top: 5%;

margin-bottom: 5%;

}

body {

width: 100%;

height: 100%;

}

@media (min-width: 992px) {

...

}

SafeFlight

Welcome to SafeFlight.

Not sure if it's safe to fly? Welcome to SafeFlight - your go-to resource for preflight planning and on-site risk assesment for flying your sUAS. Simply enter current weather conditions, and SafeFlight will notify you if it's safe to fly.


If you aren't sure whether it's legal to fly, you are able to find out using SafeFlight through an embedded version of AirMap, an open source webapp that makes airspace laws easy to understand and follow.

Legal Disclaimer
Neither SafeFlight, nor AirMap should be used exclusively to determine whether it is safe to fly. Unfroseen circumstances affecting the safety of flight can arise, and neither SafeFlight nor AirMap (or any similar apps, for that matter)

can help you with those. Please use common sense and good judgement when piloting sUAS. They are not toys and are extremely dangerous if misused or mishandled.

Get Started

How's the weather?

Clear

Overcast

Drizzle

Heavy Rain

Thunder

Is it daytime?

Day

Night

Go to this page and move to the area that your flight will be taking place. Then, look at the top left for the color of the "Warning" symbol. (triangle with "!") Please record that color below.

Green

Yellow

Orange

Red

Calculate Conditions

time.js

$(document).ready(function() {

var d = new Date();

var n = d.getHours();

alert("jQuery loaded!");

function ajax() {

$.ajax({

type: 'GET',

url: 'https://apps.roen.us/safeflight/beta/f-eval.php',

data: 'time=' + n

})

}

})

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值