JavaScript Ajax form not working with jquery append ajax form not working,ajax form not working mvc,ajax

This code form is working, but it doesn't call the ajax form chat_process.php. I need to call the ajax form and alert a message.

var html = "";

for(...) {
    html += '<form class="form_deletechatmessage" action="chat_process.php" method="post">';
    html += '<button type="submit" class="trashchat">Delete</button>'   
    html += '<input type="hidden" name="task" value="chatdelete">';
    html += '<input type="hidden" name="token" value="80a86781f1ab0200c17e4a39f42588e5">';
    html += '<input type="hidden" name="id" value="1">';
    html += '</form>';
}

$('#discussion').append(html);

$(".form_deletechatmessage").ajaxForm({ 
    success     : function(result) {        
        var result = trim(result);

        if(result == 'success') {
            alert("Success");
        } else {
            alert(result);
        }
    }       
}); 

The whole code:

function getChatText(){
    $.ajax({
        dataType: 'json',
        url: "chat_process.php?task=refresh&token=" + token + "&lastTimeID=" + lastTimeID,
        success: function(data) {
                var jsonData = JSON.parse(data);
                var jsonLength = jsonData.results.length;
                var html = "";
                for (var i = 0; i < jsonLength; i++) {
                    var result = jsonData.results[i];

                    var ida = $("#ida").val();

                    var you = "";

                    html += '<form class="form_deletechatmessage" action="chat_process.php" method="post">';
                    if(ida == result.aid) {
                        html += '<li class="self">';
                        you = " (ti)"
                    } else {
                        html += '<li class="other">';
                    }
                    html += '<div class="avatar"><img src="http://localhost/project/images/avatars/' + result.aid + '/' + result.avatar + '" /></div>';
                    html += '<div class="messages">';
                    html += '<button type="submit" class="trashchat" title="Izbriši poruku"><i class="fa fa-trash-o"></i></button>'                 
                    html += '<p><font style="font-weight: 600; color: ' + result.color + '">' + result.name + you + '</font> kaže:</p>';
                    html += '<p>' + result.chattext + '</p>';
                    html += '</div>';
                    html += '</li>';
                    html += '<input type="hidden" name="task" value="chatdelete">';
                    html += '<input type="hidden" name="token" value="' + token + '">';
                    html += '<input type="hidden" name="id" value="' + result.id + '">';
                    html += '</form>';

                    lastAdminID = result.aid;
                    lastTimeID = result.id;
                }
                if(html != "" && lastTimeID != 0) {
                    $('.discussion').append(html);

                    var objDiv = $(".discussion");
                    objDiv.scrollTop = objDiv.scrollHeight; 

                    if(ida != result.aid) {
                        audioElement.play();

                        $.titleAlert("Imate novu poruku!", {
                            requireBlur:        false,
                            stopOnFocus:        true,
                            stopOnMouseMove:    true,
                            interval:           700
                        }); 
                    }                                   
                }
        },
    });
}
Answer:1

I am using the demo code for intlTelInput provided here I am able to get the dial code using following var intlNumber = $("#phone").intlTelInput("getSelectedCountryData"); But i am not ...

I am using the demo code for intlTelInput provided here I am able to get the dial code using following var intlNumber = $("#phone").intlTelInput("getSelectedCountryData"); But i am not ...

Cannot reproduce MDN's example («Using an object in an array-like fashion»). let obj = { length: 0, addEl: function (element) { [].push.call(this, element); }; }; // Node ...

Cannot reproduce MDN's example («Using an object in an array-like fashion»). let obj = { length: 0, addEl: function (element) { [].push.call(this, element); }; }; // Node ...

  1. call using push

I would like to start tracking e-commerce with Google Analytics, to do this I need to pass the values of my data layer into GA using GTM. I have read endless amounts of documentation on the subject ...

I would like to start tracking e-commerce with Google Analytics, to do this I need to pass the values of my data layer into GA using GTM. I have read endless amounts of documentation on the subject ...

  1. ecommerce tracking with google tag manager
  2. ecommerce tracking with google analytics
  3. ecommerce tracking with tag manager
  4. ecommerce tracking with analytics
  5. ecommerce tracking tag manager

Take this code for example; it is a Redux reducer function: export default (state = initialState, action) => { switch (action.type) { case EMPLOYEE_UPDATE: { ...

Take this code for example; it is a Redux reducer function: export default (state = initialState, action) => { switch (action.type) { case EMPLOYEE_UPDATE: { ...

  1. does depression cause memory loss
  2. does gabapentin cause memory loss
  3. does anxiety cause memory loss
  4. does stress cause memory loss
  5. does metformin cause memory loss
  6. does xanax cause memory loss
  7. does ambien cause memory loss
  8. does alcohol cause memory loss
  9. does wellbutrin cause memory loss
  10. does anesthesia cause memory loss
  11. does lexapro cause memory loss
  12. does menopause cause memory loss
  13. does diabetes cause memory loss
  14. does ptsd cause memory loss
  15. does ms cause memory loss
  16. does omeprazole cause memory loss
  17. does zoloft cause memory loss
  18. does trazodone cause memory loss
  19. does lamictal cause memory loss
  20. does benadryl cause memory loss