There is a button on a website when clicked opens a small pop-up. The posting parameters if I see in the HttpFox is in JSON.
My knowledge about javascript and AJAX is zilch. When the button in question is clicked the function Eam.Ooba.Entry() is called.
Can someone explain me what the following function is trying to do:
__EAMSTATE - is a posting parameter.
Eam.Ooba.Entry = function ()
{
Eam.Ooba.Open.Current = null;
Eam.Prev.length = 0;
Eam.Ooba.Open();
};
Eam.Ooba.Open = function ()
{
var request = new Object();
request.State = Eam.GetState();
var dto = { 'request': request };
$.ajax({ url: "OOBAStart.aspx/OobaOpen", data: JSON.stringify(dto) })
.done(function (msg) { Eam.Ooba.Render(msg, "Eam.Ooba.Open();");
Eam.Ooba.Open_SuccessCallBack(); }).fail(function (msg) { Eam.Dialog.AjaxFailCallback(); });
};
Eam.GetState = function ()
{
if ($("#__EAMSTATE").length > 0) return $("#__EAMSTATE").val();
else return null;
};
Since I can't post the pic of the httpfox neither can I answer, this is how it looks like in httpfox under Post Data Window:
{"request":{"State":"yNNZQG3MCaqYfaU zYaAfF3mjpBqbUjkIP6gNJAmZfrLkq2UN6kpZEqXGM77Reo2cpSuEcrgh6/jLD 5dWGree0TNGw 2z7V0KhhMGm/3xaf8YwX10YI6rBLyGIBHIrHU1Z0bpq2kTT1TwEgICdPTfFc4i/wbliNMH8zRF U6ihoDGUjvqE/AfeCHKVIVRGeX8jCY57JuEtCmK5qKfTpxEukTnKmYI17ng9OlPQZFZfMSDPcz1nj eUU5LbSmxtDNXdMHROTTiNGR6BZqjSUGKgJ/iczaTFAAsICSikDpXK1lUfMOCgmAFuMwIihDcizkH9 kx ikdNqxGNRw4GpY9MSuzchfbxxpNRxzeGS/mTmS6fX2 5zTEjHpH61smEvsU8Rd6oiQLZVYXJa4q798fk IsnDvFJqDjCPFh pEr0a6RjrGp1FyY6HU/xOPj08Bm9OGwl4G/XG2Mm3FUHO/xSUiYZyB4kgp4Di5Vx/EaoOaW5PJJrj9O wyQLVNpofC8F NFzd59Rmbrexe0c6R8T/O6ihw4mxyH9W2tw/H31TL4Y3IzvpXCLqyOFZGahwmaGmfxH6zmYncoLZ0TnWo59LKfqEbE5cUpTGn8iLliwd//E1Sr5Ogiw8P9eb9Wo5pSftA
And under Header tab: (Request-Line) /OOBAStart.aspx/OobaOpen
Thats how it looks in the HTTPFox. I am trying to do exaclty the same posting through a script. But I don't get the value for "State:" I see in the HttpFox anywhere in the source file. All I see in the source file is value for parameter __EAMSTATE which is somewhat similar to State: but not exactly. That is because __EAMSTATE is being serialized by JSON.stringify() method, Am I correct here?
And if I and correct and I have to convert the String value of __EAMSTATE from source file into JSON object using Java then I think I can use the following things:
String s1 = new String("__EAMSTATE value")
Gson gson = new Gson();
String json = gson.toJson(s1);