| @@ 37-51 (lines=15) @@ | ||
| 34 | * Treat ajax post |
|
| 35 | **************************************/ |
|
| 36 | $action = $httpUtil->getGet('a'); |
|
| 37 | if ('checkAge' == $action) { |
|
| 38 | $age = trim($userAge); |
|
| 39 | ||
| 40 | // Age must be positive, between 0~200 |
|
| 41 | // Assign message when new ReturnValue instance is not needed, but keep |
|
| 42 | // return additional information is good for debug. |
|
| 43 | if (is_numeric($age) && 0 <= $age && 200 >= $age) { |
|
| 44 | $rv = new ReturnValue(0, 'success'); |
|
| 45 | } else { |
|
| 46 | $rv = new ReturnValue(-1, 'fail'); |
|
| 47 | } |
|
| 48 | ||
| 49 | echo $rv->toJson(); |
|
| 50 | exit; |
|
| 51 | } |
|
| 52 | ||
| 53 | ||
| 54 | /*************************************** |
|
| @@ 34-48 (lines=15) @@ | ||
| 31 | * Treat ajax post |
|
| 32 | **************************************/ |
|
| 33 | $action = $httpUtil->getGet('a'); |
|
| 34 | if ('checkAge' == $action) { |
|
| 35 | $age = trim($userAge); |
|
| 36 | ||
| 37 | // Age must be positive, between 0~200 |
|
| 38 | // Assign message when new ReturnValue instance is not needed, but keep |
|
| 39 | // return additional information is good for debug. |
|
| 40 | if (is_numeric($age) && 0 <= $age && 200 >= $age) { |
|
| 41 | $rv = new ReturnValue(0, 'success'); |
|
| 42 | } else { |
|
| 43 | $rv = new ReturnValue(-1, 'fail'); |
|
| 44 | } |
|
| 45 | ||
| 46 | echo $rv->toJson(); |
|
| 47 | exit; |
|
| 48 | } |
|
| 49 | ||
| 50 | ||
| 51 | /*************************************** |
|