var url="service/signProcess.aspx";
//sets the important hidden field of the form by which server decides what to send
$('#hdnReqType2').val('sign87162');
var data=$("#frmLogin").serializeArray();
var success=function(rdata, textStatus, jqXHR) {
console.log(rdata);
};
var fail=function(jqXHR, textStatus, errorThrown) {
console.log("Error" + errorThrown + " " + textStatus);
}
$.post(url,data,success,"text").fail(fail);
I am using this in the console of the page 'http://fsa.citop.in/lnct/' opened in chrome(when login form of the page is empty) and got a JSON String as response.
I found out at https://api.jquery.com/serializeArray/ that serializeArray() returns an array of objects having name and value. so when I used
var data=[{name :"txtLogId",value: ""},{name:"txtLogPass",value: ""},{name:"hdnReqType2",value: "sign87162"}];
which I thought to be equivalent object to object returned by $("#frmLogin").serializeArray() . Server gave me a HTML page in response.
I tried console.log(data) with both the version of data variable and couldn't find any difference. Please explain me whats the difference between both the version of data and what could be the correct equivalent object to serailizeArray().