Welcome Guest, Not a member yet? Register   Sign In
Help with adding a jquery alert box after form is correctly submitted
#27

[eluser]noobs[/eluser]
still not working my bro... i try to your script but same..nothing happen...

Code:
// Js in <head></head>

$(document).ready(function()
{
    $("#submit_item").click(function ()
    {
        var username = $('#username').val();
      

        $.post("form/save_user", { "username" : username },
        function(data)
        {
            $('#box_message').removeClass("msg-hide");
            $('#box_message').addClass("msg-show");

            $('#box_message').html(data.message);
        }, 'json');
    });

    $("#reset_form").click(function ()
    {
        $('#username').val('');
      
    });

});

// css
<style type="text/css">
div.msg-hide {display:none;}
div.msg-show {display:block;}
</style>

Code:
// Form
<div id="box_message" class="msg-hide">hidden temp text</div>
&lt;!-- --&gt;
Full Name:<br />
    &lt;?php
    $attrib = array('id' => 'username',
                    'name' => 'username'
                    );
    echo form_input($attrib).form_error('username'); ?&gt;
    
       &lt;?php
    $attrib = array('id' => 'submit_item',
                    'name' => 'submit_item',
                    'value' => 'save'
                    );
    echo form_submit($attrib); ?&gt;
    &lt;?php
    $attrib = array('id' => 'reset_form',
                    'name' => 'reset_form',
                    'value' => 'Reset'
                    );
    echo form_reset($attrib);
    ?&gt;
&lt;?php echo form_close(); ?&gt;

thx your suggestion bro.... i am confuse use jquery in codeigniter Sad


Messages In This Thread
Help with adding a jquery alert box after form is correctly submitted - by El Forum - 12-10-2010, 06:30 AM



Theme © iAndrew 2016 - Forum software by © MyBB