I am trying to understand what happens when I click a button, I get a POST request to which I get POLL request (the result). Now I want to be able to do the request without clicking, without using event triggers, I want to be able to do the request by typing it to the Firebug -command line. The button has a keydown -event with function "fn.apply(object, args)"
which calls some object and args which I don't know yet.
- Without the information, is there some way to redo the just done POST request without clicking?
Related post here where I am asking about events, now the scope is just trying to replicate POST -request to get POLL request.
I think I have all relevant information stored to the browser with things such as session ID so I need just to trigger the function which triggers the POST query or to trigger the POST query directly.
How can I do the POST query?
If I cannot do the POST query again with these information, what else do I need to do a POST query?
What does the Silverlight usage with SVC infer? Do I need to format the query somehow or is the POST query standardized?
POST/POLL URLS
http://game.com/Presentation/Service.svc/ajaxEndpoint/StartSearch
http://game.com/Presentation/Service.svc/ajaxEndpointPoll
POST StartSearch
Request Headers
Host game.com
User-Agent Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110422 Ubuntu/10.04 (lucid) Firefox/3.6.17
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 115
Connection keep-alive
Content-Type application/json; charset=UTF-8
X-Qooxdoo-Response-Type application/json
Referer http://game.com/index.aspx
Content-Length 110
Cookie __utma=30514082.25780803.1305937283.1306259330.1306374895.6; __utmz=30514082.1306376876.6.8.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=JSON%20site%3Agame.com; __utmb=30514082.9.10.1306374895; __utmv=; __utmc=30514082; s_sq=%5B%5BB%5D%5D; s_cc=true; s_ria=flash%2010%7Csilverlight%20not%20detected
Pragma no-cache
Cache-Control no-cache
POLL Request Headers
POST /Presentation/Service.svc/ajaxEndpoint/Poll HTTP/1.1
Host: game.com
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110422 Ubuntu/10.04 (lucid) Firefox/3.6.17
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Content-Type: application/json; charset=UTF-8
X-Qooxdoo-Response-Type: application/json
Referer: http://game.com/index.aspx
Content-Length: 295
Cookie: __utma=30514082.25780803.1305937283.1306259330.1306374895.6; __utmz=30514082.1306376876.6.8.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=JSON%20site%3Agame.com; __utmv=; __utmc=30514082; s_sq=%5B%5BB%5D%5D; s_cc=true; s_ria=flash%2010%7Csilverlight%20not%20detected
Pragma: no-cache
Cache-Control: no-cache
[Update]
Directed by reply to Ajax, I think it may work something like below. It runs but do not work as supposed (debugging...):
var client = new XMLHttpRequest();
client.open("POST", "http://game.com/Presentation/Service.svc/ajaxEndpoint/StartSearch", true);
client.setRequestHeader("Content-Type", "application/json; charset=utf-8");
client.send('{"session":"xxxxx开发者_JS百科x-xxxx-xxxx-xxxx-xxxxxxxxxx","cityid":"787878788","maxGold":0,"resType":0,"maxTime":86400}');
alert( client.getResponseText );
// document.getElementById("myDiv").innerHTML= client.responseText;
Format of the JSON in POLL reply from POST request
One format of the JSON, apparently having some sort of validating stuff before request. It is received after the POST query as a POLL. If I can understand right, I need a new request ID, new time and I may need to update something.
{"session":"xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx","requestid":"111","requests":"UA:\fMM:888,0,\fCAT:1\fSERVER:\fALLIANCE:\fQUEST:\fEE:\fPLAYER:\fCITY:111111111\fWC:\fWORLD:\fVIS:c:111111111:0:-1111:-111:222:444\fUFP:\fREPORT:\fMAIL:\fFRIENDINV:\fTIME:11111111111111\fCHAT:\fSUBSTITUTION:\fINV:\fALL_AT:\fMAT:333333333\fSEARCH:\f"}
jQuery option
many answers suggest jQuery so I ran the jQuery source here in Firebug but not getting it working, trying. It is probably the easiest way to do the POST query. If someone could tell some sort of vizualiser to see my POLL queries, it would be greatly appreciated (not knowing certain which is wrong, using firebug's profiler and debugger). It may be that I do not catch the output but it is coming, currently receiving undefined
as reply.
WOW you looked to much into what you computer is doing and what you need to do,
Go look up AJAX (XMLHttpRequest) -- http://www.w3schools.com/ajax/default.asp
For best result use jQuery
$().ajax( url:"" data:{"pollPostName":"pollactiveID"} dataType:"json" );
If you give me the full link for how i can access the poll i will write it for you. using what every frameworks you have or dont have if native is needed
http://api.jquery.com/jQuery.post/
write a function that triggers $.post then you can use that function in the JS command line.
精彩评论