[Answer]-How to get the 'id' of form id in jquery

1👍

You say you have to remove the is_ajax() method, which shows that actually you are not seeing the Ajax post at all, but the standard browser form submission. This is because you have not prevented the default submit action in your jQuery code.

It should be:

$('.chatroom').submit(function(event) {
    event.preventDefault();
    $.ajax({
        ...

0👍

The following is not the cause of your problem, but will cause a JS bug (syntax errors):

$(function(){
    $('.chatroom').submit(function () {
        $.ajax({
            type: "POST",
            url: "/dashboard",
            data : {
                chatroom_id: $(this).attr('id')
            } // you had a dangling comma here
        });
    }); // you were missing a closing bracket and paren here
});

Leave a comment