Error making a query with the Ajax function help

1

I have a problem with a function, what I'm doing is a search engine and, inside, there's another div that when I click on it, it's supposed to give me the user's data but not do anything

but if I take it out of the div of the search engine if it works, that's why it

This is the search engine:

$(document).ready(function(){
    $('body').on('keyup', '#search', function (e) {


        e.preventDefault();
        var search = $(this).val();
		var text_trim = $.trim(search);
		
        if (text_trim == "") {
			$("#search_error_contact").hide();
            $("#result_Search_contact").hide();
            $("#search_input_clean").hide();
            $("#contact_list_user").show();
        } else {
			$('#result_Search_contact').html('<center><img class="loader_data_img_ajax" src=" " alt="" /></center>');
			$("#search_error_contact").hide();
            $.ajax({
                url: Ajax_Requests_File(),
                type: 'POST',
				cache: false,
                data: 'search=' + search,
                beforeSend: function () {

                    $('#searcbtn').attr('disabled', 'disabled');
                },
                success: function (data) {

                    $("#contact_list_user").hide();
                    $("#search_input_clean").show();
                    $("#result_Search_contact").html(data).show();
                    
                    $('#searcbtn').removeAttr('disabled', 'disabled');
					if(data!=""){
						$('#result_Search_contact').html(data);
					}
                },
                error: function(){
                   $("#search_error_contact").show();
             
                }
            });
        }

    });

});

This is the ajax code that has the div with the content:

	$('.wall_chat_users').on('click', function(){
		
		$('#add_chats_users').html('<center><img class="po_add_chat loader_data_img_ajax" src=" " alt="" /></center>');		
		var data_id = $(this).data('id');
		$.ajax({
			url: Ajax_Requests_File(),
			type: 'POST',
			cache: false,
			data: 'add_chat_user='+ data_id,
			success: function(data){
				$("#add_chats_users").html(data);//$('#more-info').html(data.html);
				if(data!=""){
					$('#add_chats_users').html(data);
				}
			},
			error: function(jqXHR, textStatus, errorThrown){
				$('#add_chats_users').html('<center><img src="https://cdn2.iconfinder.com/data/icons/metro-uinvert-dock/128/Wifi_Not_Connected.png"/></center>');             
			}
		});
	});
    
asked by sode 07.06.2018 в 22:47
source

0 answers