WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a wordpress custom theme that started giving a weird error out from the blue.

Every time you post a comment it will return a javascript alert with all the content of the page.

I haven't made any changes to the theme that would have effect in this so I have no idea why is this happening, I tried removing all the javascript of the theme, updating the comments related files in the server (the same error happens locally) and replacing the comments.php with a generic template or using <?php comment_form(); ?> instead of <?php comments_template(); ?>.

You can test it in http://www.faf.fi/uutiset/faf-international-ohjaajakoulutukset-alkavat-pian/ (text in Finnish, Nimi = Name, Sähköposti = Email).

Any ideas?

share|improve this question
up vote 1 down vote accepted

I tried removing all the javascript of the theme, updating the comments related files in the server (the same error happens locally)

The problem is a result of this file(you obviously didn't disable that one in testing).

Blocking that script in my browser resolves the issue, but i think it's this area of the script specifically that's failing..

    $('form').submit( function(){

        var form = $(this);

        if ( validateForm( this ) ) {

                form.attr('action'),        //url   A string containing the URL to which the request is sent
                form.serialize(),           //data  A map or string that is sent to the server with the request.

                //success   A callback function that is executed if the request succeeds
                function(response, status, request){
                    // do something with response
                    alert( stripTags(response) );

                //dataType  The type of data expected from the server (text, xml, json)
        //Prevent default
        return false;

The alert you're seeing is generated by that function. I have no idea what the cause of your issue is nor how to resolve it(i'm no JS expert), but i'm pretty certain this function is the source of your problem.

Hope that helps.

share|improve this answer
Thanks t31os! Of course it was that. The problem was that submit function was interacting with every Form in the website. But it's strange that it was working before. – UXTE Feb 17 '11 at 15:45
Happy to have helped. With regard to that running on every form, if that's not what you need, couldn't you simply update the selector to point at specific forms, say those with a class? eg. $('form.someclass').submit( function(){ ... – t31os Feb 17 '11 at 15:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.