[buddypress-trac] [BuddyPress Trac] #5648: problem with warning AJAX functions

buddypress-trac noreply at wordpress.org
Sat May 17 01:50:48 UTC 2014


#5648: problem with warning AJAX functions
--------------------------+--------------------------------------
 Reporter:  dmuneras      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  low           |  Milestone:  Awaiting Review
Component:  Groups        |    Version:  1.9.2
 Severity:  minor         |   Keywords:  dev-feedback 2nd-opinion
--------------------------+--------------------------------------
 When the AJAX function to load more activity updates is executed and PHP
 warnings are triggered. The response is caught by the .fail function of
 the jQuery post function (if you are using promises to handle the
 response), because the response is a malformed JSON. That happens because
 warnings are attached to the response.

 Example:

 [[Image(http://dmuneras.com/lectures/errorAjaxBuddy.png)]]

 I am fixing a plugin called Activity plus tabs extension, which has all
 AJAX functions broken because of a problem with event delegation.

 In order to get what I want I had to create my own AJAX handlers. I avoid
 the problem by following an advice from this post:
 http://codex.wordpress.org/AJAX_in_Plugins

 I added the ob_clean() function to remove warnings from my JSON response
 (you can add the warnings to the JSON).

 [[Image(http://dmuneras.com/lectures/fixAjaxBuddy.png)]]

 I don't know if my solution is a good one, but it works.

 It could be nice if you can fix it in Buddypress because that problem is
 very annoying when you are working in a development environment.


 This is the line in the buddypress JS where the AJAX function for this
 case is triggered:

 [[Image(http://dmuneras.com/lectures/globalbbpressLoadMore.png)]]


 Thanks in advance,
 Daniel Múnera Sánchez.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5648>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list