I want to get the value of label LabRef and pass to Ajax function for processing. At moment i am retrieving value of hidden field from draggable div inside Repeater control but now need to pass the label value also.
function OnDragStart(e) {
e.dataTransfer.effectAllowed = 'move';
e.dataTransfer.setData('text', $(this).find('HiddenField[ID*="HiddenField1"]'));
}
function OnDrop(e) {
$(this).append("" + e.dataTransfer.getData('text') + "");
var data = new Array(1);
$("#img1 div").each(function (index) {
data[index] = "'" + this.innerHTML + "'";
});
function sendMyAjax(URL_address) {
$.ajax({
type: 'POST',
url: URL_address,
contentType: "application/json; charset=utf-8",
data: '{products:[' + data.join() + ']}',
dataType: 'json',
success: function (results) { alert(results.d); },
error: function () { alert('error'); }
}); return false;
};
}
Sachin SinghPosted Jul 1, 2022, 8:22 AM
peterPosted Jul 1, 2022, 2:39 PM
i have not shown all the code.
originally you could drag a series of items before processing server side using ajax once button clicked. i converted it to sending individual items so i gather i dont need an array to store and process individual values?
what i do require is to send both the hiddenfield value and also the MessageType value to the webMethod via Ajax.
So how do you reference LabRef label and add both these values to the e.dataTransfer.setData method then process via Ajax method ?
The answer helped me accomplish what i wanted!
Thanks