I am trying to call a void method in my Controller when I click on a Button using Ajax. But when I do so nothing happens. It does not hit the Controller method.
This is my View:
<td>
<span class="leftalign">
<input type="submit" id="myButton" value="Picked Output" />
</span>
</td>
<script>
$("#myButton").click(function(e){
e.preventDefault();
var rootUrl = "~/Report/";
$.ajax({
//url: $(this).attr("href"),
url: rootUrl + "Picksapout/pickssap",
success: function(){
alert("#");
}
});
});
</script>
My Controller Void Method:
public class PicksapoutController : MasterController
{
private void pickssap()
{
//...
}
}
~/. whatever you place in the ajax url parameter needs to be something that you could place in an anchor element's href attribute.