• I got error message “no element found” every couple seconds when I use the P2 theme.

    Error: no element found
    Source File: wp-admin/admin-ajax.php?p2ajax=true&action=get_latest_comments&load_time=2011-01-17%2021:51:21&lcwidget=false&…
    Line: 1

    To solve this problem I did this works:
    1. check if this a special problem only happened on my site.
    – I checked other sites they use the P2 theme. Show the same error in FireFox. So I know this is a bug of P2 theme.

    2. How to fix it?
    – find and read the get_latest_comments function in ajax.php
    – P2 theme check for new posts/comments every 30 seconds (“30000″ , this can be changed in the js.php).
    – If no new comments found, return header(“HTTP/1.1 304 Not Modified”) in the function get_latest_comments.

    * I think here is the problem.
    Firefox is expecting to get something it can parse as XML back, and throwing an XML parsing error when it gets an empty response. So I replace

    header(“HTTP/1.1 304 Not Modified”)
    with
    header(‘Content-Type: text/plain’);

    , and Firefox will not try to parse the response as XML, and there should be no error.

    – also made the same change in get_latest_posts function.

    It works.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi bennybian,
    Thanks for the report. To help us reproduce it, could you please tell us your WP version and P2 version?

    Thread Starter bennybian

    (@bennybian)

    Hi lance,

    WordPress 3.0.4.
    P2 1.2.2

    Thanks,

    venusian_cat

    (@venusian_cat)

    I can confirm that the issue remains under WP 3.1.2 and P2 1.2.3, and that bennybian’s solution of swapping the header parameter fixes it.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Fixed “no element found” error in Firefox’ is closed to new replies.