[wp-trac] [WordPress Trac] #15291: receiving data with response from ajax call

WordPress Trac wp-trac at lists.automattic.com
Sat Nov 6 10:27:02 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:  General          |      Version:  3.0.1   
 Severity:  normal           |   Resolution:          
 Keywords:  ajax,response    |  
-----------------------------+----------------------------------------------
Changes (by christian_gnoth):

  * status:  closed => reopened
  * resolution:  invalid =>


Comment:

 thanks for the infos. it is working, but the problem is still there, that
 if some of the function creates an error message, that those error
 messages are together with the data i return in one string.

 i too see that the problem is not with the admin-ajax.php file.

 i return an json encoded string with die($return_data), but this
 return_data is together in one string with the error message the
 wp_insert_post creates.

 i think it is a problem of jQuery.post and its implementation in
 wordpress.

 i will try a ob_start, ob_end_clean around the wp_insert_post call, but
 actually each function in the ajax call could create some error messages.

 intresting is, that the wp_insert_post is working - it creates, the post,
 creates the error message too and I return the error message with the
 post_id of the created post.

 on the javascript side I extract the json string with my post_id from the
 whole string and show the created post to the user.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/15291#comment:16>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list