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 6681233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:34:00+00:00 2026-05-26T04:34:00+00:00

question marks are hard to search for in google. What does this mean step

  • 0

question marks are hard to search for in google.

What does this mean step by step?

 $page = isset($_POST['page'])?$_POST['page']:"0";

I am guessing it means if Post['page'] is set use that value and if not use 0? but i dont get it in detail. Also when I do var_dump($page) i get "NaN" ; even though POST['page'] is not set to anything yet. What’s going on?

–> For full disclosure, I am using this Javascript function to pass the value of page..for a “load more”/pagination functionality.

$(function(){
    $("#more").click(loadPosts);
    loadPosts();
      var count = 0;
        var num = 2;
    function loadPosts() {
        $(".loading").show("fast");
        count += num;
        $.post("load.php", {'page': count}, function(data){
            $("#contents").append(data);
            $(".loading").hide("fast");
        });
    }
});
  • 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-26T04:34:01+00:00Added an answer on May 26, 2026 at 4:34 am

    The ?: syntax is called the ternary operator and does exactly what you think. If the first part (before the ?) is truthy, the first option (before the :) is used; if not, the second option is.

    The error that you’re getting is because you haven’t set your number values yet. This is how the browser reads your code:

    $(function(){
        function loadPosts() {
            $(".loading").show("fast");
            count += num;
            $.post("load.php", {'page': count}, function(data){
                $("#contents").append(data);
                $(".loading").hide("fast");
            });
        }
        var count;
        var num;
        $("#more").click(loadPosts);
        loadPosts();
        count = 0;
        num = 2;
    });
    

    As you can see, count += num will be set before var count = 0 and var num = 2 are run, since loadPosts() is run before they are set. This is because of something called “hoisting”, where function and variable declarations are moved to the very top of their containing scope.

    Because you’re trying to add undefined to undefined (since neither variable has been set yet), you get NaN: “not a number”. To fix this, move the function and variable declarations to the top of the scope, before you call loadPosts:

    $(function(){
        function loadPosts() {
            $(".loading").show("fast");
            count += num;
            $.post("load.php", {'page': count}, function(data){
                $("#contents").append(data);
                $(".loading").hide("fast");
            });
        }
        var count = 0;
        var num = 2;
        $("#more").click(loadPosts);
        loadPosts();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: What do two question marks together mean in C#? What does the
Does anyone know why there are question marks (with a number) after the images
Reading this question I found this as (note the quotation marks) code to solve
Possible Duplicate: What do two question marks together mean in C#? can any one
Hey there, I have dynamic question marks on my landing page that scroll with
Possible Duplicate: What do two question marks together mean in C#? I'm trying to
In JDBC I can use question marks for query parameters, like this: SELECT *
Possible Duplicate: What do two question marks together mean in C#? Hi, I was
Please do not mark it as a dupe of this question just yet: Bold
This question may sound cliched, but I am in a situation here. I am

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.