DEV Community

loading...

Sending an Ajax Call by clicking a checkbox to Controller

Md. Ashikur Rahman
Experience in full stack (PHP, Java, Javascript, MySQL, MongoDB, Linux, Apache - LAMP, MEAN stacks) software development following Agile (Scrum, XP).
・1 min read

$(document).ready(function() {
$("input[name='field_name']").click(function(){
var checkedValue = $("input[name='field_name']:checked").val();

var post_url = "controller_name/function_name/" + checkedValue;
$.ajax({
type: "POST",
url: post_url,
success: function(d) {

} //end success
}); //end AJAX
});
});

Discussion (0)