[wp-trac] [WordPress Trac] #15291: receiving data with response from ajax call
WordPress Trac
wp-trac at lists.automattic.com
Tue Nov 2 16:49:27 UTC 2010
#15291: receiving data with response from ajax call
-----------------------------+----------------------------------------------
Reporter: christian_gnoth | Owner:
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: General | Version: 3.0.1
Severity: normal | Resolution: invalid
Keywords: ajax,response |
-----------------------------+----------------------------------------------
Changes (by nacin):
* status: reopened => closed
* resolution: => invalid
* severity: major => normal
Comment:
exit; is required to prevent anything else from being executed.
You need to decide how you want data to be returned, which is simply
echo'd. Generally we use die('1') for success, die('0') for failure,
die('-1') for insufficient permissions. Then you can check for the strings
1, 0, and -1.
Or, you could return the post ID, if that's what you need.
You can also return the data using json_encode(). Or, you can use the
WP_Ajax_Response class.
You can also return JS directly to execute it, etc. It's up to you on how
you wish to implement your ajax call.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/15291#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list