Ajax之后的Java语言[重复]

This question already has answers here:
                </div>
            </div>
            <div class="grid--cell mb0 mt8">Closed <span title="2013-01-20 01:07:09Z" class="relativetime">7 years ago</span>.</div>
        </div>
    </aside>

Possible Duplicate:
Obtain dates with JavaScript before AJAX request

I have an Ajax Request like this:

function ajaxrequest(str){

    var aircraft = $("#resultdiv");
        aircraft.load("./other_file.php?icao="+str, function(){
        });
    }

If I put Javascript in the other_file.php don´t works. I don´t know why? But If use the javascript code directly works fun! But I need the function. How Can I change the function to the result of this with Javascript works fun?

For example:

If the other_file.php have this:

<script>
function example(){

        var id = document.getElementById('id').value;
                $("div2").text(id);
    }
</script>

This don´t work because it needs obtain the var id, but if the element has the value 2365. The javascript code to obtain it document.getElementById('id').value; don´t works because javascript don´t work. But If I do this directly and no by the function ajaxrequest all works fine.

This is the really contain of the other_file.php

<script>
    $(function() {
        $("#editaircraft")
            .button()
            .click(function editForm() {
        });
    });

    function editForm(){

        var icao = document.getElementById('icao').value;
        var name = document.getElementById('name').value;
        var weightempty = document.getElementById('weightempty').value;
        var weightfull = document.getElementById('weightfull').value;
        var cargofull = document.getElementById('cargofull').value;
        var cruisespeed = document.getElementById('cruisespeed').value;
        var range = document.getElementById('range').value;
        var price = document.getElementById('price').value;
        var firstclassseats = document.getElementById('firstclassseats').value;
        var businessclassseats = document.getElementById('businessclassseats').value;
        var economyclassseats = document.getElementById('economyclassseats').value;
        ajax.open("POST","edit_aircraft_process.php",true);
        ajax.onreadystatechange=function(){
            if(ajax.readyState==4)
            {
            refreshTable(function(){$("#loadingdialog").dialog('close');});

            refreshTable(function(){$("#result").fadeIn(); document.getElementById("result").innerHTML=ajax.responseText;});
            setTimeout(function() { $("#result").fadeOut() }, 5000);
            }
        }
    ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    ajax.send("icao="+icao+"&name="+name+"&weightempty="+weightempty+"&weightfull="+weightfull+"&cargofull="+cargofull+"&cruisespeed="+cruisespeed+"&range="+range+"&price="+price+"&firstclassseats="+firstclassseats+"&businessclassseats="+businessclassseats+"&economyclassseats="+economyclassseats);
    $("#editaircraftdialog").dialog('close');
    $("#loadingdialog").dialog('open');
    }
</script>

<?php
require_once ('../../config.php');
$icao = $_REQUEST["icao"];

$query = "SELECT * FROM aircrafts WHERE ICAO = '$icao'";

$result = mysql_query($query);
if (!$result)
{
die (mysql_error());
}

?>
<form action="javascript:editForm();" method="post" enctype="application/x-www-form-urlencoded"> 
<?php
echo '<table border="0">';
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){

echo '<tr><td class="forms">ICAO:</td><td><input type="text" id="icao" name="icao" size="30" value=';
echo $row["ICAO"] . "></td></tr>";

echo '<tr><td class="forms">Name:</td><td><input type="text" id="name" name="name" size="30" value=';
echo $row["Name"] . "></td></tr>";

echo '<tr><td class="forms">Weight Empty:</td><td><input type="text" id="weightempty" name="weightempty" size="30" value=';
echo $row["WeightEmpty"] . "></td></tr>";

echo '<tr><td class="forms">Weight Full:</td><td><input type="text" id="weightfull" name="weightfull" size="30" value=';
echo $row["WeightFull"] . "></td></tr>";

echo '<tr><td class="forms">Cargo Full:</td><td><input type="text" id="cargofull" name="cargofull" size="30" value=';
echo $row["CargoFull"] . "></td></tr>";

echo '<tr><td class="forms">Cruise Speed:</td><td><input type="text" id="cruisespeed" name="cruisespeed" size="30" value=';
echo $row["CruiseSpeed"] . "></td></tr>";

echo '<tr><td class="forms">Range:</td><td><input type="text" id="range" name="range" size="30" value=';
echo $row["Range"] . "></td></tr>";

echo '<tr><td class="forms">Price:</td><td><input type="text" id="price" name="price" size="30" value=';
echo $row["Price"] . "></td></tr>";

if($row["FirstClassSeats"] != NULL && $row["FirstClassSeats"] != 0){
echo '<tr><td class="forms">First Class Seats:</td><td><input type="text" id="firstclassseats" name="firstclassseats" size="30" value=';
echo $row["FirstClassSeats"] . "></td></tr>";}

if($row["BusinessClassSeats"] != NULL && $row["BusinessClassSeats"] != 0){
echo '<tr><td class="forms">Business Class Seats:</td><td><input type="text" id="businessclassseats" name="businessclassseats" size="30" value=';
echo $row["BusinessClassSeats"] . "></td></tr>";}

if($row["EconomyClassSeats"] != NULL && $row["EconomyClassSeats"] != 0){
echo '<tr><td class="forms">Economy Class Seats:</td><td><input type="text" id="economyclassseats" name="economyclassseats" size="30" value=';
echo $row["EconomyClassSeats"] . "></td></tr>";}

echo '<tr><td><input id="editaircraft" type="submit" value="Edit Aircraft"></td></tr>';

}
echo "</table>";
?>

</form>

The obtains of vars are undefinid!

</div>
var aircraft = $("#resultdiv");

function ajaxrequest(str){
    $.get("other_file.php?icao="+str, function(result){
          aircraft.append(result);
    });
}

other_file.php

...

    <script>
            $("#editaircraft")
                .find('button') /* ??? */
                .click(editForm);

        function editForm(){

            var icao = document.getElementById('icao').value;
            var name = document.getElementById('name').value;
            var weightempty = document.getElementById('weightempty').value;
            var weightfull = document.getElementById('weightfull').value;
            var cargofull = document.getElementById('cargofull').value;
            var cruisespeed = document.getElementById('cruisespeed').value;
            var range = document.getElementById('range').value;
            var price = document.getElementById('price').value;
            var firstclassseats = document.getElementById('firstclassseats').value;
            var businessclassseats = document.getElementById('businessclassseats').value;
            var economyclassseats = document.getElementById('economyclassseats').value;
            ajax.open("POST","edit_aircraft_process.php",true);
            ajax.onreadystatechange=function(){
                if(ajax.readyState==4)
                {
                refreshTable(function(){$("#loadingdialog").dialog('close');});

                refreshTable(function(){$("#result").fadeIn(); document.getElementById("result").innerHTML=ajax.responseText;});
                setTimeout(function() { $("#result").fadeOut() }, 5000);
                }
            }
        ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        ajax.send("icao="+icao+"&name="+name+"&weightempty="+weightempty+"&weightfull="+weightfull+"&cargofull="+cargofull+"&cruisespeed="+cruisespeed+"&range="+range+"&price="+price+"&firstclassseats="+firstclassseats+"&businessclassseats="+businessclassseats+"&economyclassseats="+economyclassseats);
        $("#editaircraftdialog").dialog('close');
        $("#loadingdialog").dialog('open');
        }
    </script>