Cannot access data in XMLHttpRequest callback in jQuery

When I run the following XmlHttpRequest

$.get('../entries/find_most_recent',
    {name:$("#name").val()}, 
    function(data) {
        console.log("data");
    });

The result can be seen in this screenshot of Firebug:

alt text http://img842.imageshack.us/img842/2564/screenshot20100727at904.png

But when I remove the quotes from console.log ("data"), like this:

$.get('../entries/find_most_recent',
    {name:$("#name").val()}, 
    function(data) {
        console.log(data);
    });

Nothing appears in Firebug. The answer is just a string, as seen in the screenshot above. How do I access it? Thanks for reading.

+3
source share
2 answers

The returned object must be defined and handled accordingly.

jquery.com " , XML, , JavaScript JSON, MIME, ".

http://api.jquery.com/jQuery.get/

+1

, $.get, "../entries/find_most_recent" ( , :../entries/find_most_recent.cgi .html .php ..)

0

Source: https://habr.com/ru/post/1756731/


All Articles