Have 2 problems
1) @Rogerio said is right, you used "sucess": when the correct way is "success":
But now with jquery you can use the following methods:
jqXHR.done(function( data, textStatus, jqXHR ) {});
An alternative construct to the success callback option, the .done() method replaces the deprecated jqXHR.success() method. Refer to deferred.done() for implementation details.
jqXHR.fail(function( jqXHR, textStatus, errorThrown ) {});
An alternative construct to the error callback option, the .fail() method replaces the deprecated .error() method. Refer to deferred.fail() for implementation details.
jqXHR.always(function( data|jqXHR, textStatus, jqXHR|errorThrown ) { });
An alternative construct to the complete callback option, the .always() method replaces the deprecated .complete() method.
In response to a successful request, the function's arguments are the same as those of .done(): data, textStatus, and the jqXHR object. For failed requests the arguments are the same as those of .fail(): the jqXHR object, textStatus, and errorThrown. Refer to deferred.always() for implementation details.
jqXHR.then(function( data, textStatus, jqXHR ) {}, function( jqXHR, textStatus, errorThrown ) {});
Incorporates the functionality of the .done() and .fail() methods, allowing (as of jQuery 1.8) the underlying Promise to be manipulated. Refer to deferred.then() for implementation details.
Read about in: http://api.jquery.com/jquery.ajax/
A type, you using "npiso="+valorpiso, but this not encoding, prefer use json, like this: { npiso: valorpiso } (Jquery auto encoding data)
2) Don't use repeated IDs in HTML, this repeate ID by results number:
while($dados=mysql_fetch_array($result)){
echo "<div id='caixa'>";
Use class= instead of id=
First, update Jquery to last version
Javascript:
$.ajax({
"type": "POST",
"url": "getpiso.php",
"data": { "npiso": valorpiso }
}).done(function(data) {
console.log(data);
$(".list_caixa").html(data);
}).fail(function(err) {
console.log("Failed", err);
}).always(function() {
console.log("complete");
});
"HTML":
$piso1=$_POST["npiso"];
$result=mysql_query("select * FROM rooms where floor='$piso1' ");
while($dados=mysql_fetch_array($result)){
echo "<div class='list_caixa'>";
echo "<p>$dados[block].$dados[floor].$dados[room]</p>";
echo "</div>";
}