1.11M Members

Jquery to post to a php file

 
0
 

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" );
                                }
    }});
 
2
 

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" );
    }
}
 
0
 

thank you

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article