Welcome Guest, Not a member yet? Register   Sign In
ci + jquery
#11

[eluser]ardinotow[/eluser]
Thanks mate...Now I can use codeigniter validation to validate form in ajax way.

I have more question.
Supposed I have one page that contain comment form and comment list. If I post new comment I want to get these instance:
1. The form is validate using ajax, and when no errors occur my new post will be inserted in database then showing 'input success' message (all in ajax way).
2. While showing 'input success' message, the comment list will refreshed in ajax.

I know how to do the first instance, but I don't know how to do the second instance. Please anyone help me to get this work.

p.s. Here is my jquery script for doing the first instance
Code:
// GLOBAL PARAMS
var file            =    'http://localhost/advoria-ci-FA/comment/do_input_ajax';
var placeholder        =    '#wrapper';
var waitholder        =    '#err';
var waitnote        =    '<img alt="" src="http://localhost/advoria-ci-FA/advoria-assets/gambar/wait.gif" />Please Wait ...';
            
// DOM READY
$(document).ready(function()
{
      
    // AJAX SUBMIT OPTIONS /
    var options = {
        beforeSubmit:    wait,
        success:        ShowResult,
        url:            file,
        type:              'post',
        dataType:          'json',
        clearForm:         false,
        resetForm:         false,
        timeout:           3000
    };
    // ON SUBMIT FORM
    $('#ajaxcomment').submit(
        function(){$(this).ajaxSubmit(options);return false;});
    //*/
});
            
// SHOW RESULT
function ShowResult(data)
{
    if(data.success == 'false')
    {
        $('#id_user_error').html(data.id_user_error).slideDown('slow');
        $('#isi_komentar_error').html(data.isi_komentar_error).slideDown('slow');
        $('#rating_error').html(data.rating_error).slideDown('slow');
    }
    if(data.success == 'true')
    {
        $('#id_user_error').fadeOut('slow').hide();
        $('#isi_komentar_error').fadeOut('slow').hide();
        $('#rating_error').fadeOut('slow').hide();
        $(placeholder).html(data.title).slideDown('slow');
    }
    $(waitholder).fadeOut('slow').hide();
}        

            
// WAIT MESSAGE
function wait()
{
    $(waitholder).html(waitnote).fadeIn('fast');
}
            
// CLEAR WAIT MESSAGE
function wipe()
{
    $(waitholder).fadeOut('fast').html('');
}


Messages In This Thread
ci + jquery - by El Forum - 05-18-2008, 10:12 PM
ci + jquery - by El Forum - 05-19-2008, 02:55 AM
ci + jquery - by El Forum - 05-19-2008, 03:10 AM
ci + jquery - by El Forum - 05-19-2008, 03:35 AM
ci + jquery - by El Forum - 05-19-2008, 05:19 PM
ci + jquery - by El Forum - 05-20-2008, 09:45 AM
ci + jquery - by El Forum - 05-20-2008, 12:38 PM
ci + jquery - by El Forum - 05-24-2008, 06:00 PM
ci + jquery - by El Forum - 05-24-2008, 11:47 PM
ci + jquery - by El Forum - 05-25-2008, 08:34 PM
ci + jquery - by El Forum - 05-29-2008, 03:06 PM
ci + jquery - by El Forum - 05-29-2008, 04:04 PM
ci + jquery - by El Forum - 05-30-2008, 09:46 AM
ci + jquery - by El Forum - 08-18-2009, 12:27 AM
ci + jquery - by El Forum - 12-17-2009, 01:19 PM
ci + jquery - by El Forum - 12-18-2009, 04:44 AM
ci + jquery - by El Forum - 06-14-2010, 09:46 PM
ci + jquery - by El Forum - 09-12-2010, 08:14 PM



Theme © iAndrew 2016 - Forum software by © MyBB