Client side:
function Save () {
var data_temp = Convert_to_json (checkbox_selected ());
alert (data_temp);
$.ajax ({
Type: "Post",
ContentType: "Application/json",
Url:webserviceurl + "/createorder_createso",
Data: ' {' list ': ' + data_temp + ', ' Id ': ' 0 '} ',
DataType: "JSON",
Success:function (d) {
if (D.D = = NULL | | d.d = = undefined) {
Alert ("Please Login");
Window.location.href = "login.html";
Return
}
alert (D.D);
},
Error:function (e) {alert ("Error");}
});
}
Function Convert_to_json (ar_data) {
var temp = "";
for (var i = 0; i < ar_data.length; i++) {
var ar_temp = ar_data[i];
Temp + = ' {"Product": "' + ar_temp[0] + '", " Set ":" ' + ar_temp[1] + ' "," Qty ":" ' + ar_temp[2] + ' "," Price ":" ' + ar_temp[3] + ' "}, ';
}
Temp = temp.substr (0, temp.length-1);
temp = ' [' + temp + '] ';
return temp;
}
function checkbox_selected () {
var ar = document.getelementsbyname ("ckb_product");
var ar_checked = new Array ();
for (var i = 0; i < ar.length; i++) {
if (ar[i].checked) {
var temp = ar[i].parentnode.parentnode;//.children[3].children[0];
var prodct = $ (temp.children[1]). HTML ();
var set = $ (temp.children[2]). HTML ();
var Qty = $ (temp.children[3].children[0]). Val ();
var price = $ (Temp.children[4].children[0]). Val ();
var ar1 = new Array ();
Ar1.push (PRODCT);
Ar1.push (set);
Ar1.push (Qty);
Ar1.push (price);
Ar_checked.push (AR1);
}
}
return ar_checked;
}
WebService End:
[WebMethod (EnableSession = True)]
public string Createorder_createso (list<set_product_list> List, String Id)
{
string re_value = Id;
return re_value;
}