0

I have a JSON code:

"rows": [
        {
            "id": 1,
            "name": "nazwa1"
        },
        {
            "id": 2,
            "name": "nazwa2"
        },
        {
            "id": 3,
            "name": "nazwa3"
        },
        ...
        {
            "id": 99,
            "name": "nazwa99"
        }
    ]

In jQuery I have a JSON object in listName

the script is as follows:

$('#displayData').dataTable({
    "aaData": listName,
    "aoColumns": [
        { "mDataProp": "id" },
        { "mDataProp": "name" }
    ]
});

But is wrong, how can I complete data in jQuery from listName?

2
  • 1
    What do you mean by In jQuery I have JSON object in listName? Commented Nov 15, 2012 at 10:33
  • I want pass data from listName to dataTable (the lat script in my post) and show on page. Commented Nov 15, 2012 at 10:35

1 Answer 1

1
fxnRelatedData = function () {
        $(document).ready(function () {
            $('#displayData').change(function () {
                $.each(rows, function (index) {
                       /* give some class name to your table rows*/
                        $(".ClassName").html(rows[index].name);
                 });      
            });
        });
    };

fxnRelatedData();

Sign up to request clarification or add additional context in comments.

1 Comment

Yes I want display json values in a table, but I don't understand what do you mean 'ques r8'?

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.