Javascript 如何发送$user';ajax可加载文件中的s变量?

Javascript 如何发送$user';ajax可加载文件中的s变量?,javascript,php,jquery,ajax,Javascript,Php,Jquery,Ajax,我有一个变量用户,可以在mPost.php文件中发送它,但是在这个脚本开始之前,如何在可加载的mLoad.php文件中发送它呢。?谢谢 $(document).ready(function(){ $("#message_area").load('mLoad.php'); $("#userArea").submit(function(){ $.post('mPost.php', $('#userArea').serialize(), function(data){ $("

我有一个变量用户,可以在mPost.php文件中发送它,但是在这个脚本开始之前,如何在可加载的mLoad.php文件中发送它呢。?谢谢

$(document).ready(function(){
$("#message_area").load('mLoad.php');

$("#userArea").submit(function(){
    $.post('mPost.php', $('#userArea').serialize(), function(data){
        $("#message_area").append(data);
        });

    return false;
});
}); 

必须首先将变量传递给脚本:

$.get('mLoad.php', {variable:'data'}, function(response){
    $('#message_area').html(response);
}); 

$.get('mLoad.php',{variable:'data'},函数(response){$('message_area').html(response);});谢谢,但它不起作用。错误:“注意:未定义的索引:C:\web\source\mLoad.php中的用户,在第7行”在mLoad中,您必须将
$user=$\u GET['variable']
;对不起,我错了,它正在工作,谢谢。你介意把我的答案标记为正确吗?谢谢