Sending an Ajax Call by clicking a checkbox to Controller

github logo ・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
});
});

twitter logo DISCUSS
Classic DEV Post from Jun 4

What's one resource most devs don't know that you use regularly?

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

It's like Medium meets Reddit, but specifically for software developers. Sign up now ❤️

(And we're open source!)