0

This is my sample code populating data table on my app.But i want to send a parameter with the url !!

Parameter name 'form' integer value.

 $(document).ready(function() {
        $('#example').DataTable( {
            "processing": true,
            "serverSide": true,
            "ajax": {
                "url": "getKeyDetails.html",

            }
        });
    });
6
  • have you tried changing the URL like "url": "getKeyDetails.html?form=1" Commented Nov 14, 2015 at 9:21
  • yup i getting response from server. but the parameter is dynamic Commented Nov 14, 2015 at 9:22
  • from where this dynamic integer value will come? I hope the parameter name form is still the static one and will not change. Commented Nov 14, 2015 at 9:27
  • i mean parameter value not the name. Commented Nov 14, 2015 at 9:29
  • ya..its ok but from where this parameter value needs to be picked? Is it coming from a select box, text box or any other JavaScript variable? Commented Nov 14, 2015 at 9:31

1 Answer 1

1

Considering above inputs from your end you can check below code:

$(document).ready(function() {
        var paramValue = $("#yourSelectBoxID").val();

        $('#example').DataTable( {
            "processing": true,
            "serverSide": true,
            "ajax": {
                "url": "getKeyDetails.html?form="+paramValue,

            }
        });
});

Here we are assuming that there is a select box on your page with an id yourSelectBoxID. So whatever value is selected on DOM ready; that value will be passed within URL to the server side.

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.