views:

59

answers:

2

i did this but not working

if(error.join()!="")
{
    $("#sub_error").fadeTo(200,0.1,function()
    {
        $("#sub_error").html(error.join("<br/><br/>")).append('<br/>
         <input type="button" name="err_ok" id="err_ok" value="ok">')
         .addClass('subboxerror').fadeTo(900,1);
     bindEvents();
    });

    function bindEvents() 
    {
        $("#err_ok").click(function() 
        {
            $("#sub_error").fadeTo(1000,0);
        });
    }
}
else
{
    $("#frm_sub")
     .removeClass().addClass('messagebox')
     .text('Submitting...').fadeIn("slow");

    $.post("register_user.php",
    { 
        $('#frm1').serialize() 
    } , 
    function(data)
    {
        alert(data);
    });
});
}
+1  A: 

Try:

$.post("register_user.php", $('#theForm').serialize(), function(data) { //...

Edit:

You should not be wrapping the return value of ('#frm1').serialize() in curly braces. The return value of serialize is a string, which the post() call will pass directly to the server.

Miles
Yeah, you have a }, where there should only be a ,
Chad Grant
@Deviant: is that a comment on my answer, or jarus's code?
Miles
A: 

If your input elements come from a form, then you can use the serialize method.

kgiannakakis