return responseText from jQuery.get()

后端 未结 4 892
粉色の甜心
粉色の甜心 2020-12-10 03:58

I tried to do something like this :

var msg = $.get(\"my_script.php\");

I thought msg would be set to the text returned by my_script.php,i.

4条回答
  •  隐瞒了意图╮
    2020-12-10 04:47

    The return value is simply the jqXHR object used for the ajax request. To get the response data you need to register a callback.

    $.get("my_script.php", function(data) {
      var msg = data;
      alert(msg);
    });
    

提交回复
热议问题