Hey there, I have a question as I am quite new to working with Asp.net. I have a Javascript code where I want to pass data to my Controller.
<script type="text/javascript">
$("#SearchButton").on("click", function () {
var $sucheMoped = [];
$("#tab_logic tbody tr")
.each(function () {
var $Item = $(this);
var suchfeld = $Item.find("td > input[name='Suchfeld']").val();
var schluessel = $Item.find("td > select[name='Suchschluessel'] > option:selected").val();
alert(suchfeld + "&&&" + schluessel);
$sucheMoped.push({
Suchfeld: suchfeld,
Suchschluesseltyp: schluessel
});
});
window.open('@Url.Action("MainView","MainView")?SuchObject='+$sucheMoped);
})
</script>
I am simply trying to send the "sucheMoped" from my JavaScript code to my Controller. My Controller is expecting an IEnumerable of Objects with properties Suchfeld and Suchschluesseltyp.
Does anyone have any ideas on how to approach this?
Thanks everyone.