how to return response from post in a variable? jQuery
        Posted  
        
            by robertdd
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by robertdd
        
        
        
        Published on 2010-04-25T14:43:21Z
        Indexed on 
            2010/04/25
            14:53 UTC
        
        
        Read the original article
        Hit count: 324
        
i use this function to return the response of post:
$.sendpost = function(){
    return jQuery.post('inc/operations.php', {'operation':'test'}, "json");
},
i want to make something like this:
in:
$.another = function(){
  var sendpost = $.sendpost();
  alert(sendpost);
}
but i get: [object XMLHttpRequest]
if i print the object with:
jQuery.each(sendpost, function(i, val) {
  $(".displaydetails").append(i + " => " + val + "<br/>");
});
i get:
details  abort => function () { x && h.call(x); g("abort"); }
dispatchEvent => function dispatchEvent() { [native code] }
removeEventListener => function removeEventListener() { [native code] }
open => function open() { [native code] }
setRequestHeader => function setRequestHeader() { [native code] }
onreadystatechange => [xpconnect wrapped nsIDOMEventListener]
send => function send() { [native code] }
readyState => 4
status => 200
getResponseHeader => function getResponseHeader() { [native code] }
responseText => mdaaa from php
how to return only the response in the variable?
© Stack Overflow or respective owner