Problem with ajax method and parameters..

Problem with ajax method and parameters..

ricagmcrricagmcr Posts: 1Questions: 1Answers: 0
edited November 2021 in General

I have a datatabe with the following ...

...
"ajax": {
"url": "/ MyController / MyAction? ag77_clv_ubics =" + $ .trim ($ ('# Tb_XXX'). val ()),
...
...
...

Where Tb_XXX is an Input.

The first time I open the dtatable it receives the correct parameter in MyAction

public ActionResult MyAction (string ag77_clv_ubic) --------> The first value typed in the input is always received
.
..

But if I close the datatable and change the value of the input "Tb_XXX" and invoke the datatable / ajax again, then MyAction always receives the first value I send in the input, even if the value of the input changes.

I need the above to filter a datatble based on the value typed in the Tb_XXX inpu.
Please help...

Work with MVC

Answers

  • kthorngrenkthorngren Posts: 21,336Questions: 26Answers: 4,951

    You are initializing the ajax url with the value of that varaible. It won't change. Use the ajax.data option as a function for the ability to change the value sent in the parameters.

    Kevin

Sign In or Register to comment.