Could someone please let me know if there's a way to pass the current block on an ajax call?
Scenario: On initial get request ,the current block populates the view that includes a dropdown say for instance country list. Next i need an ajax call to get in the list of states based on the country id selected The ajax call i make right now gives me the country id but ,the current block is null. So is there a way to pass the current block as well as an additional parameter with country id which i can then use to filter the items from the current block values?(The data is within the current block & not database & so i need the current block)
$.ajax({
type: "GET",
url: "/dummycontroller/getstates/",
data: {
countryid: countrid
},
success: () => {
},
error: () => {
}
});
Controller code
[HttpGet]
public virtual ActionResult GetStates(ABCBlock currentBlock, string countryid)
{
//Here i get the country id but i want current block as well which right now is null
}
Is there a way to achieve this?