Can't change div-Tag after load()-response


#1

Hello alltogether

I have a problem with my html-JQuery-Ajax project.

I have an empty div-Container.

<div class="form-group" id="UserDiv">
						
</div>

In this div-Container with the id=“UserDiv” i will load a select field of users, which is generated by a php script.
This is the jquery-Function of the call:

function loadDiv(){
	
	$("#UserDiv").load("../includes/UserProwalus.inc.php", function(response, status, xhr) {
		
		if(status=="success"){
			alert(response);
			$("#UserDiv").html(response);
			
		}
		
	});	
} 

The php script looks so. Also the database query works very well. This is a self-generated answer(for test purposes) as the normal database query actually looks like:

$content="";
$content.="<select class='selectpicker show-tick show-menu-arrow' id='UserBlock' name='UserBlock' data-width='75%' data-size='8' title='PrOWaLuS+ - User'>";
$content.="<option value='15|31'>Mr Green</option>";
$content.="</select>";
echo $content;

The problem is, that the script works absolute fine, because the correct result is displayed in the alert-window.
But the command $("#UserDiv").html(response); does not work and i don’t know why?
Even if i let return a simple response from the php-script, the response isn’t displayed in the div-tag.

I need your help.
Thanks a lot.


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.