문제

How can I insert a value to variable with:

$("#TEST").load("GET.php #Message_1");

An example of that:

var MSG = $("#TEST").load("GET.php #Message_1");

alert(MSG);
도움이 되었습니까?

해결책

You need to get the value in the callback function:

$("#TEST").load("GET.php #Message_1", function() {
    var msg = $(this).text();
    alert(msg);
});

다른 팁

This should work:

$("#TEST").load("GET.php #Message_1");

var msg = $("#TEST").val();
alert(msg);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top