tags:

views:

44

answers:

2

hi,

 $('tr td:first-child').click(function() {
        var foobar = $(this).text();
        $("#showgrid").load('/Product/List/Item?id=' + foobar);
    });

when I am seding foobar value like this in the Actionresult method I am getting string id value perfectly but I am not able to display the grid?

but intresting thing is when I am seding like this

 $("#showgrid").load('/Product/List/Item?id=' + "12345");

then I am able to display the grid.. foobar result is same 12345..

what is the differnt between these two types?

can any body help me out..

thanks

+1  A: 

From the docs: text() returns the combined text contents of each element in the set of matched elements, including their descendants. So, if you have any other nodes that contain text in the first-child of the td, it'll include that text as well. Can you post some markup so we can see what you are targeting?

Typeoneerror
+1. this is probably the problem.
David Murdoch
+1  A: 

Try this:

var foobar = $.trim($(this).text());

You may have some extra spaces in there.

David Murdoch
+1 - This is what I was thinking too.
patrick dw
Yes the problem with Spaces thanks for lettingme know. I appreciate that.. thanks
kumar