We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37766
    • 1 Posts
    Hi,

    I'm working on a musician's website with MODX Revolution 2.1.3-pl (traditional) including a blog with Quip 2.1.3.

    Everything is working perfectly well. The player needs to be running when visitors navigate to other pages. Also that part works perfectly with jQuery and ajax.

    But I don't get the Quip comments running with $.ajax or $.post.

    I'm loading the blog using jQuery ajax and binding the submit events of the comment forms.

    As far as I understand it, Quip makes a POST request to the following URL:
    mysite.com/#quip-comment-preview-box-qcom

    When the validation is successful and the comment gets added, this first request is being redirected to an URL like the following one:
    mysite.com/?quip_approved=1#qcom28 - this is a GET request.

    The first one works nicely - both with $.ajax or $.post.

    When there is a validation error, I get that also displayed with the $.ajax/$.post.

    In case of successful validation though, the comment will not be added to Quip and there is no redirect to the second page. I tried with $.ajax, $.post - neither one is doing the trick.

    I'm passing the same POST parameters as the non-ajax call. Still nothing is happening. What am I doing wrong?

    PLEASE HELP, I'm lost!

    I tried with the following functions (also attached as txt file).

    Either one I'm calling in $(document).ready with

    $('#content').ajaxBlog();

    or

    $('#content').bindQuipForms();

    THANK YOU VERY MUCH FOR YOUR HELP,
    Stefan.

    Here's the code:

    (function(){
    $.fn.ajaxBlog=function(){

    return this.each(function(){

    $('form',this).bind('submit',function(){

    var $form = $( this ),
    nospam = $form.find( 'input[name="nospam"]' ).val(),
    thread = $form.find( 'input[name="thread"]' ).val(),
    parent = $form.find( 'input[name="parent"]' ).val(),
    auth_nonce = $form.find( 'input[name="auth_nonce"]' ).val(),
    preview_mode = $form.find( 'input[name="preview_mode"]' ).val(),
    name = $form.find( 'input[name="name"]' ).val(),
    email = $form.find( 'input[name="email"]' ).val(),
    comment = $form.find( 'textarea[name="comment"]' ).val(),
    quip_post = $form.find( 'button[name="quip-post"]' ).val(),
    url = $form.attr( 'action' );


    $.ajax({
    url: url,
    type: "POST",
    data: { nospam: nospam, thread: thread, auth_nonce: auth_nonce, preview_mode: preview_mode, parent: parent, name: name, email: email, comment: comment,quip_post:quip_post },
    dataType: "html",
    success:function(data){

    $('#content').css('opacity',0).html($('#content > *',data)).animate({opacity:1}, cool;
    $('#content').ajaxBlog();
    }
    });
    return false;
    })
    });
    };
    })();

    ----------------------------------------------------------------------------------------------------

    And this one:

    (function(){
    $.fn.bindQuipForms=function(){

    return this.each(function(){
    $('form',this).bind('submit',function(event) {

    event.preventDefault();

    var $form = $( this ),
    nospam = $form.find( 'input[name="nospam"]' ).val(),
    thread = $form.find( 'input[name="thread"]' ).val(),
    parent = $form.find( 'input[name="parent"]' ).val(),
    auth_nonce = $form.find( 'input[name="auth_nonce"]' ).val(),
    preview_mode = $form.find( 'input[name="preview_mode"]' ).val(),
    name = $form.find( 'input[name="name"]' ).val(),
    email = $form.find( 'input[name="email"]' ).val(),
    comment = $form.find( 'textarea[name="comment"]' ).val(),
    quip_post = $form.find( 'button[name="quip-post"]' ).val(),

    url = $form.attr( 'action' );

    $.post( url,
    { nospam: nospam,
    thread: thread,
    auth_nonce: auth_nonce,
    preview_mode: preview_mode,
    parent: parent,
    name: name,
    email: email,
    comment: comment,
    quip_post: quip_post
    },
    function( data ) {
    $('#content').css('opacity',0).html($('#content > *',data)).animate({opacity:1}, cool;
    $('#content').bindQuipForms();
    }
    );
    });
    });
    };
    })();
    ----------------------------------------------------------------------------------------------------