I have an ajax setup that I'm testing right now, pretty much the idea is to send some data from the dropdowns to a php script, do some calculations and then return the result, it works fine and returns the result, but now instead to just send one result and output it, I want to send several results and output them, I can send some data to a PHP script, so I'm sure I can send some back.
In any case, it sends only the first result, not the rest.
Here is ajax
<script>
$("document").ready(function (){
$(".add_extension").change(function(){
var m = document.getElementById('meter_square');
var meter_square = m.options[m.selectedIndex].value;
var s = document.getElementById('story_height');
var story_height = s.options[s.selectedIndex].value;
$.ajax({
type: "GET",
url: "script.php",
data: { meter_square: meter_square, story_height: story_height },
dataType: "json",
statusCode: {
200: function (result, result2)
{
$("#expected_gain").html(result.value);
$("#house_price").html(result2.value2);
}
}
});
})
});
</script>
And here is the PHP script
<?php
$meter_square = $_GET["meter_square"];
$story_height = $_GET["story_height"];
$result = $meter_square + $story_height;
$result2 = $meter_square * $story_height;
echo json_encode(array("value" => $result, "value2" => $result2));
?>
, , , , , - , , , .