I'm trying to send some data to an aspx page by clickin on button but it doesn't seem to work by using jQuery Ajax Post ,however if I just chage the ajax type to GET it works fine ! but I do really want to make it with ajax post method since my transferred data size is really huge!
$('#sendDataBtn').click(function () {
selecteddata = document.getElementById("<%=textbox.ClientID%>").value; //might be over 1800 caracters
$.ajax({
url: '<%=SPContext.Current.Web.Url %>/_admin/CreateFilefromRecievedData.aspx',
type: 'POST',
dataType: 'text',
data: { "data":selecteddata } ,
headers: {
"accept": 'application/x-www-form-urlencoded',
"content-type": 'application/x-www-form-urlencoded',
"X-RequestDigest": $("#__REQUESTDIGEST").val()
}, //==> this fixed everything :)
error: function () {
alert("error");
},
success: function (data) {
alert(data);
}
});