AJAX加载PHP响应

How can I load data from my PHP response via ajax into a panel?

My PHP outputs correctly and I can see a table in the response, but I can;t get it to build the data on my webpage.

Here is my jquery/ajax so far. It passed the value to PHP correctly and PHP builds the table via its echo, but what am I missing for AJAX to display the table?

PHP:

<?php
foreach ($lines as $value) {
   echo "<input name='data[]' value='$value'><br/>";
} 
?>

JQUERY:

$(function () {
            $('#rotator').change(function (e) {
                var rotator = $("#rotator").val();
                $.ajax({
                    type: "POST",
                    url: "tmp/JFM/National/national.php",
                    data: {
                        rotator: rotator
                    },
                    success: function (result) {
                         $('#panel').load(result);
                    }
                })
                return false;
            });
        });

move your function from:

$.ajax({...,success: function(){...}});

to

$.ajax({..}).done(function(){...});

if it doesn't work, try to add async:false into the ajax object...

$.ajax({...,async:false}).done(function(){...});

Hope it helps... =}

The answer to this was two fold.

I was attempting to append to my main div, which apparently can't happen. I created a new empty div and was able to load the results there.

Beyond that, the comments to change .load(results) to .html(results) were needed.

The correct jquery code is below.

$(function () {
            $('#rotator').change(function (e) {
                var rotator = $("#rotator").val();
                $.ajax({
                   type: "POST",
                    url: "tmp/JFM/National/national.php",
                    data: {
                        rotator: rotator
                    },
                    success: function (result) {
                        console.log(result);
                         $('#test').html(result);
                    }
                })
                return false;
            });
        });