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