return responseText from jQuery.get()
问题 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.e. the responseText of the jqXHR object. It apparently doesn't work like that as msg is always set to "[object XMLHttpRequest]" Is there a quick 1 line way to do what I want? Thanks. 回答1: After some testing, I ended up finding a solution. I need the call to be synchronous, $.get shorthand function is always asynchonous, so I will need to use $.ajax, like