[wp-trac] [WordPress Trac] #15291: receiving data with response from ajax call
WordPress Trac
wp-trac at lists.automattic.com
Wed Nov 3 15:42:48 UTC 2010
#15291: receiving data with response from ajax call
-----------------------------+----------------------------------------------
Reporter: christian_gnoth | Owner:
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: 3.1
Component: Inline Docs | Version: 3.0.1
Severity: normal | Resolution:
Keywords: ajax,response |
-----------------------------+----------------------------------------------
Comment(by christian_gnoth):
in my javascript ajax call i have the following jquery.post call:
{{{
jQuery.post( ajaxurl, data,
function( return_data, response, xobj )
{
bbnuke_result_page_url = response;
alert('Server response: ' + response);
alert('Type of return data: ' + typeof(return_data));
alert('Type of resposne: ' + typeof(response));
alert('type of xobj: ' + typeof(xobj));
for(key in return_data)
{
alert('Key is ' + [key] + ', Value is ' + data[key]);
}
jQuery.each(xobj, function(key, value)
{
alert('Key: ' + key + ' Value: ' + value);
});
}, "json"
);
}}}
in my ajax php function i return the following:
{{{
$return_obj = array( 'post_id' => $post_id, 'url' => $url );
die( $return_obj );
}}}
the return_obj is appended to the responseText item of the xobj variable.
that is of no use.....
if i try to return data with
{{{
$x = new WP_Ajax_Response( array(
'what' => 'post_id',
'id' => $post_id,
'data' => $url,
'supplemental' => $url
) );
$x->send();
}}}
i do not get any answer.
actually I would like to change it back to a ticket as bug not only for
the documentation as ti works not properly.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/15291#comment:10>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list