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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:01:27+00:00 2026-05-24T07:01:27+00:00

UPDATE: I am getting the same error. When I click on the x ,

  • 0

UPDATE:

I am getting the same error. When I click on the x, it should be returning {id: 23}, but it is returning {id: NaN} instead. This problem corrects itself if I remove the ternary operator.


I have made a change to my webpage:

It was this:

$( "#notifications" ).prepend( "<div class='notification' id='n" + notifications.d[i].id + "'><span class='notification_text'>" + notifications.d[i].text + "</span><a href='#' class='notification_button' id='b" + notifications.d[i].id + "' value='x'>x</a></div>" ).show();

and I changed it to this, added a ternary condition depending on the value of notifications.d[i].sticky:

$( "#notifications" ).prepend( "<div class='notification' id='n" + notifications.d[i].id + "'><span class='notification_text'>" + notifications.d[i].text + "</span>" + ( notifications.d[i].sticky ? "" : "<a href='#' class='notification_button' id='b'" + notifications.d[i].id + "' value='x'>x</a>'" ) + "</div>" ).show();

That part works fine, it not creating the x link if sticky is true.

However, when I click on any other x, I get a serverside error message:

NaN is not a valid value of Int32

The serverside code looks like this:

[WebMethod()]
public int CloseNotification(int id) {
    using (connection = new SqlConnection(ConfigurationManager.AppSettings["connString"])) {
        using (command = new SqlCommand("update notifications set closed_by = @user where id = @id", connection)) {
            command.Parameters.Add("@id", SqlDbType.Int, 4).Value = id;
            command.Parameters.Add("@user", SqlDbType.VarChar, 4).Value = "abc";

            connection.Open();
            intAffectedRows = command.ExecuteNonQuery();
            connection.Close();
        }
    }

    return intAffectedRows;
}

Anyone know why I am getting that error?

I’m thinking I’ve made a mistake with the ternary section, probably a double or single quote mistake, but I can’t see it.

  • 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-24T07:01:28+00:00Added an answer on May 24, 2026 at 7:01 am

    You have a Syntax error in your code on the line that reads

    id='b'" + notifications.d[i].id + "' value='x'>x</a>'" ) + "</div>" ).show();
    

    There is an extra ' after the b. It should read:

    id='b" + notifications.d[i].id + "' value='x'>x</a>'" ) + "</div>" ).show();
    

    Edit:

    You also have an extra ' at the end of your ternary operation.

    ( notifications.d[i].sticky ? "" : "<a href='#' class='notification_button' id='b" + notifications.d[i].id + "' value='x'>x</a>'" )
    

    should be:

    ( notifications.d[i].sticky ? "" : "<a href='#' class='notification_button' id='b" + notifications.d[i].id + "' value='x'>x</a>" )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to update a hashtable in a loop but getting an error: System.InvalidOperationException:
I am trying to do a terminal update and I keep getting this error,
I am getting the following error when trying to update my project from Intellij
I am getting the following error when trying to update an object using nhibernate.
Getting an error whenever we click a particular button/link on our site. It is
I am extremely confused why I am getting this strange error all the sudden:
I'm getting this awkward error any time I try and create a dialog from
I'm having trouble with python. I keep getting the same error: Traceback (most recent
I'm trying to use php's mail() function but keep getting an error. I've installed
Why am I getting an error when I try to update my Heroku database?

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.