[jQuery] Usng JQUERY
[jQuery] Usng JQUERY
Plesae excuse I am being redundant here. I find it alittle
frustrating that I my mail take such a long time to get posted
here. This will probably take long too.
But I think if I just spell it out with what I think I need in order
to use JQUERY, then maybe can provide a quick example. Thats all I
need is an example.
I have this C structure at the server side that holds "session node
information"
typedef struct tagTwcNodeInfo {
DWORD NodeStatus;
DWORD ServerState;
DWORD ConnectionId;
char LastCaller[SIZE_NODEINFO_LASTCALLER];
TUserInfo User;
char UserFrom[SIZE_USER_FROM];
BOOL UserPageAvailable;
BOOL Reserved1; //UserAccountHidden;
char Activity[SIZE_NODEINFO_ACTIVITY];
char Speed[SIZE_NODEINFO_SPEED];
FILETIME TimeCalled;
FILETIME CurrentTime;
DWORD NodeNumber;
DWORD MinutesLeft;
} TwcNodeInfo;
I want to write a WEB "widget" that does does a AJAX call to the
server "/code/html-who.wcx" to get a snap shot of all the records.
The WCX will get a servier function:
int nTotal = GetNodeInfos(nodes)
which the server will fill a dynamic nodes array of TwcNodeInfo.
So the ajax calll will be I guess:
$.getJSON("/code/html-who.wcx?fmt=json", function(json){
.... Update Table?....
});
I assume presume that the JSON data the WCX will create is, assuming 3
nodes were return:
{total: 3,
[{node: 1, username: joe, time: 120}],
[{node: 2, username: mary, time: 2}]
[{node: 3, username: larry, time: 60}]
}
Would this the approach to create a JSON representation of a multi-
record result?
If so, then all I need to see is two thing:
a) How this is "bind" or "tied" to a table display, and
b) How to make this a periodic call, i.e, like every 10 seconds.
Once I can see how that is done, then I can go from there.
Thanks
--
HLS