1

I want to send user inserted value as parameter inside JQuery data table sAjaxSource property. something like this

var UsersData = $('input[name="UserValue"]').val();

        $('#myTable').dataTable({
            "bServerSide": true,
            "sAjaxSource": "/Home/ProcessThis/UsersData",
            "aaSorting": [[1, 'desc']],
...

how to use this UsersData variable inside sAjaxSource, above sAjaxSource example doesnt work.

1 Answer 1

1

Like so I believe:

    var UsersData = $('input[name="UserValue"]').val();

    $('#myTable').dataTable({
        "bServerSide": true,
        "sAjaxSource": "/Home/ProcessThis/" + UsersData,
        "aaSorting": [[1, 'desc']],

I'm assuming you are used to PHP where you can insert variable name into string, but in JavaScript you have to concatenate.

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.