How to get exra parameter from mvc Json?

How to get exra parameter from mvc Json?

ervinservins Posts: 2Questions: 0Answers: 0
edited January 2013 in General
I am trying several hours to get extra parameter from mvc, but no luck.

My idea is to initialize dataTable and get standard parameters with "sAjaxSource" and along than a want to pass aditional parameter (test) to my textbox or someting similar.

...
string test = "";
return Json(new
{
sEcho = param.sEcho,
iTotalRecords = numberOfRecords,
iTotalDisplayRecords = numberOfFiltered,
aaData = result,
test = "testing..."
}, JsonRequestBehavior.AllowGet);


Can anybody help me?
Tnx

Replies

  • allanallan Posts: 63,552Questions: 1Answers: 10,477 Site admin
    Use fnInitComplete or listen for the `xhr` event - both of which will give you the JSON object.

    Allan
  • ervinservins Posts: 2Questions: 0Answers: 0
    edited January 2013
    Can you please give me a simple example? I tried it but no luck...
  • allanallan Posts: 63,552Questions: 1Answers: 10,477 Site admin
    There is an example in the fnInitComplete documentation: http://datatables.net/ref#fnInitComplete - the second parameter is the JSON returned from the server.

    Allan
This discussion has been closed.