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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:01:33+00:00 2026-06-10T23:01:33+00:00

Im trying to do this : When i add a student through my UI

  • 0

Im trying to do this :

When i add a student through my UI , using AJAX a row should get appended to the existing list(table) of students

So the feilds of my UI i sent to my controller, finished the db entry , from my controller i pass a Json object containing all the fields i want to show to my view (This is all working perfect).

In my view i did

success : function(result){
res = eval('('+result+')');
//Here the problem, begins , appending a row to the existing table:
$('#my_table tr:last').after('<tr>
<td>'+res.name+'</td>
<td>'+res.address+'</td>
<td><a href="javascript:void(0)">'+ res.flag== true ? "Male" : "Female" +'</a></td> // this is where im stuck !
</tr>')
}

The output is , it honestly checks for the flag value ie if flag== true it prints male , but its not displaying a link AND the gender is the ONLY thing that is displayed , not the name and address

If i remove the line

 <td><a href="javascript:void(0)">'+ res.flag== true ? "Male" : "Female" +'</a></td>

It prints the name and address correctly, and if i add the line for checking the gender it prints ONLY The gender and it is NOT anchor Tagged , like its not a link

What am i doing wrong ?

  • 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-06-10T23:01:35+00:00Added an answer on June 10, 2026 at 11:01 pm

    try using this

    <a href="javascript:void(0)">'+ (res.flag== true ? "Male" : "Female") +'</a>
    

    just a difference of brackets but might do the thing

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to do this List<String> stringList = new ArrayList<String>(); stringList.add(one); stringList.add(two); stringList.add(three);
I am trying to add a sqlite DB into an application using this: CoreData:
I'm trying to add a character limit clause to this white list regex approach
I am trying to add 1 to any newly appended id/class: jQuery: $(function(){ $(#add-new-student).click(function()
I'm trying to add Modernizr to this page: http://www.alternativeradio.org/pages/test . Modernizr works fine and
I am trying to add some logic in this. But I am not sure
I'm trying to add a value (in this case the string I Added This)
I'm trying to add some share this javascript in between the head tags of
I started by trying to add a .toggle() to this code so that the
I've encountered this problem (while trying to add SQL Server Database (.mdf) file to

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.