1
for (var i in result) 
{
 $('#tgt').append( "<li><a href='/UpdateStatusData/?id='"+result[i]+" >"+result[i]+"</a></li>");            
}

I am receiving blank in the id when extracting in server side. Please help me with the valid way of passing value to the tag.but I am getting the value when i inspect the element along with ="" as extra, you can see it in the image value:MULTINOMIAL, but when I click I could only see blank value in the server side

1
  • 1
    @Satpal thank you so much that worked for me!! :) +1 Commented Jul 12, 2017 at 11:12

1 Answer 1

4

As of now the generated link would be below hence, id is ignored.

<a href'/UpdateStatusData/?id=' 123> 

Place quotes properly so that the url is enclosed in quotes.

"<li><a href='/UpdateStatusData/?id="+result[i]+"'>"
                                  //^Removes 
                                               //^added

Use cleaner approach to create element using jQuery

var anchor = $('<a>', {
    href : '/UpdateStatusData/?id='+result[i]
});
var li = $('<li>');

li.append(anchor);
$('#tgt').append(li);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.