Getting GET values from fnServerData

Getting GET values from fnServerData

LukeLuke Posts: 4Questions: 0Answers: 0
edited May 2011 in General
I'm completely new to JSON and so far I just can't get my head around this. This code works:

[code]
"fnServerData": function ( sSource, aoData, fnCallback ) {
aoData.push( {"name": "table", "value": "mytable" });
$.getJSON( sSource, aoData, function (json) {
fnCallback(json)
});
}
[/code]

But I would like to replace "value" with a GET value, i e $_GET['table']. Any ideas??

Thanks in advance!!

Replies

  • LukeLuke Posts: 4Questions: 0Answers: 0
    Typical. Work on something for a few hours and the answer is right in front of you. Solved the issue with:

    http://www.mathias-bank.de/2007/04/21/jquery-plugin-geturlparam-version-2/

    And now:

    [code]
    "fnServerData": function ( sSource, aoData, fnCallback ) {
    aoData.push( {"name": "table", "value": $(document).getUrlParam("table") });
    $.getJSON( sSource, aoData, function (json) {
    fnCallback(json)
    });
    }
    [/code]
This discussion has been closed.