I have a jquery code below which I am using to try to get a html form that is displaied in a lightbox on a webpage to post to a php page my issue seems to be that when I click the "save" button it is not executing the jquery code below Can someone let me know if they see any errors in my below code

thanks

 $("#b_popup_4").dialog({autoOpen: false, 
                            modal: true,
                            width: 400,
                            buttons: {                            
                                "Save": function() {
                                    $.post('../includes/additem.inc.php', $('#additemform').serialize());
                                    //$( this ).dialog( "close" );
                                },
                                Cancel: function() {
                                    $( this ).dialog( "close" );
                                }
    }});

Recommended Answers

All 2 Replies

Heres one i got:

$.post("http://www.example.co.uk/test.php",{sid:sid,type:type},
        function(data){
            $('.jq_counttotal').html(data);
        }
    );

Looks like yours is missing the "what to do when got page" function

buttons: {                            
    "Save": function() {
        $.post('../includes/additem.inc.php', $('#additemform').serialize(), 
            function(data){
                alert(data);
            }
        );
    },
    Cancel: function() {
        $( this ).dialog( "close" );
    }
}
commented: Nice Answer! +9

thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.