edited: This is what i need:
sendpost = function(a,b,c){
return jQuery.post('inc/operations.php', {a:b}, c, "json");
},
rotate = function(callback){
//....
alert(callback);
}
sendpost('operation', 'test', rotate)
old post: 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?