//var resolveRequest = HttpContext.Request;
//List<Test> model = new List<Test>();
//resolveRequest.InputStream.Seek(0, SeekOrigin.Begin);
//string jsonString = new StreamReader(resolveRequest.InputStream).ReadToEnd();
//if (jsonString != null)
//{
// JavaScriptSerializer serializer = new JavaScriptSerializer();
// model = (List<Test>)serializer.Deserialize(jsonString, typeof(List<Test>));
//}
<script type="text/javascript">
$(document).ready(function () {
$("#btnSpecialDay").click(function () {
var list = new Array();
$("#SpecialDay li").each(function (index, domEle) {
var li = $(this);
var name = li.find("[name='sName']").attr("value");
var date = li.find("[name='sDate']").attr("value");
//debugger;
if (name != "" && date != "") {
var sp = new Object();
sp.Date = date;
sp.Name = name;
sp.CC = "zz";
list.push(sp);
}
});
var jsonText = JSON.stringify(list);
alert(jsonText);
$.ajax({
cache: true,
type: "POST",
url: '/Product/SpecialDay',
//data: $('#form1').serialize(),
//data: { "": eval(jsonText) },
dataType: 'json',
// data: { "": eval(jsonText) },
data: jsonText,
contentType: "application/json; charset=utf-8",
// data: "jsonText=" + jsonText,
// dataType: 'text',
//async: false,
success: function (data) {
alert(data);
},
error: function (request) {
alert("Connection error");
}
});
});
});
</script>