1

Im trying to make a table row clickable using javascript. I have a table with customers and when the row is clicked, it should forward to the detals view. But now im stuck with the javascript. First of all I cant seem to get the id of the row.. and second it dosent seem to call the Details method in the Customer controller... my javascript:

<script type="text/javascript">
$(document).ready(function(){
    $('#customers tr').click(function () {
        var id = $(this).id;
        $.ajax({
            url: '@Url.Action("Details","Customer")',
            type: 'GET',
            data: { id: id }
        });
    })
})

1 Answer 1

1

to get the id you need to do:

var id = $(this).attr( 'id' );

not sure about the other part, can you view the source in browser and verify the url?

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.